Python Forum
numpy.array has no attribute head
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
numpy.array has no attribute head
#1
I am trying to see the columns in a dataframe. I am using the following Python 3 code:

 
scaler=StandardScaler()
df=scaler.fit_transform(df)
df.head()
and I get the following error:

Error:
AttributeError Traceback (most recent call last) Input In [11], in <cell line: 3>() 1 scaler=StandardScaler() 2 df=scaler.fit_transform(df) ----> 3 df.head() AttributeError: 'numpy.ndarray' object has no attribute 'head'
I still want to see the columns in df. I did not know it was a numpy.array. How do I fix this?
Can I convert df to a dataframe?

Respectfully,

LZ
Reply
#2
I got this it is easy to change numpy.array to dataframe.

I think that will do it.

Respectfully,

LZ
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Convert numpy array to image without loading it into RAM. DreamingInsanity 7 5,910 Feb-08-2024, 09:38 AM
Last Post: paul18fr
  IPython errors for numpy array min/max methods muelaner 1 573 Nov-04-2023, 09:22 PM
Last Post: snippsat
  Expand the range of a NumPy array? PythonNPC 0 757 Jan-31-2023, 02:41 AM
Last Post: PythonNPC
  Change a numpy array to a dataframe Led_Zeppelin 3 1,126 Jan-26-2023, 09:01 PM
Last Post: deanhystad
  from numpy array to csv - rounding SchroedingersLion 6 2,205 Nov-14-2022, 09:09 PM
Last Post: deanhystad
  Seeing al the data in a dataframe or numpy.array Led_Zeppelin 1 1,155 Jul-11-2022, 08:54 PM
Last Post: Larz60+
  AttributeError: 'numpy.ndarray' object has no attribute 'load' hobbyist 8 7,143 Jul-06-2022, 10:55 AM
Last Post: deanhystad
  Cannot get output for df.head() Led_Zeppelin 0 1,075 Jun-28-2022, 02:15 PM
Last Post: Led_Zeppelin
  AttributeError: 'numpy.int32' object has no attribute 'split' rf_kartal 6 4,432 Jun-24-2022, 08:37 AM
Last Post: Anushka00
  go over and search in numpy array faster caro 7 1,770 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