Python Forum
Change a numpy array to a dataframe
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change a numpy array to a dataframe
#4
Why are you using locals()? You should almost never use locals(). Is using locals() some weird conda notebook thing? If you can get locals()[ndarray_name], it means there is a local variable that references the same object as locals()[ndarray_name). Why not use the variable?
x = "Hello World"
print(x)
print(locals()["x"])
Output:
Hello World Hello World
Your csv file will not have any column names. Is that consistent? I honestly don't know. Do you use csv files as some kind of persistent storage?
Reply


Messages In This Thread
RE: Change a numpy array to a dataframe - by deanhystad - Jan-26-2023, 09:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Elegant way to apply each element of an array to a dataframe? sawtooth500 7 441 Mar-29-2024, 05:51 PM
Last Post: deanhystad
  Convert numpy array to image without loading it into RAM. DreamingInsanity 7 5,917 Feb-08-2024, 09:38 AM
Last Post: paul18fr
  IPython errors for numpy array min/max methods muelaner 1 575 Nov-04-2023, 09:22 PM
Last Post: snippsat
  Expand the range of a NumPy array? PythonNPC 0 761 Jan-31-2023, 02:41 AM
Last Post: PythonNPC
  from numpy array to csv - rounding SchroedingersLion 6 2,215 Nov-14-2022, 09:09 PM
Last Post: deanhystad
  How to change UTC time to local time in Python DataFrame? SamKnight 2 1,619 Jul-28-2022, 08:23 AM
Last Post: Pedroski55
  numpy.array has no attribute head Led_Zeppelin 1 1,254 Jul-13-2022, 12:56 AM
Last Post: Led_Zeppelin
  Seeing al the data in a dataframe or numpy.array Led_Zeppelin 1 1,155 Jul-11-2022, 08:54 PM
Last Post: Larz60+
  array change svm 6 1,515 Jun-23-2022, 01:01 PM
Last Post: svm
  go over and search in numpy array faster caro 7 1,776 Jun-20-2022, 04:54 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020