Python Forum
Cannot get output for df.head()
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot get output for df.head()
#1
I get the following response when I run some python code and use

StandardScaler

scaler=StandardScaler()
df=scaler.fit_transform(df)
Error:
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Input In [42], in <cell line: 1>() ----> 1 df.head() AttributeError: 'numpy.ndarray' object has no attribute 'head'
I think that I know what the error is. Numpy cannot be indexed or something like that.

My question is how I fix so I can see at least the first 5 lines of the new dataframe that has been scaled.
Right now, I can see no dataframe. I just want to see the first five lines (hence, df.head())
so, I can see that the Standard Scaler did its work.

Thanks in advance.

Respectfully,

LZ
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  numpy.array has no attribute head Led_Zeppelin 1 1,271 Jul-13-2022, 12:56 AM
Last Post: Led_Zeppelin
  Pyhton code help from head first with python Shaikat_99 3 3,192 Jun-07-2020, 09:12 AM
Last Post: snippsat
  Pandas: .(head) Can I specify a range in head? eeps24 6 3,750 May-11-2020, 04:27 PM
Last Post: eeps24
  Cant get my head round the algorithm hshivaraj 1 2,341 Apr-09-2019, 10:38 PM
Last Post: Yoriz
  invalid syntax in my program, really doing my head in! Fazz92 1 3,950 May-07-2017, 12:54 PM
Last Post: Bass

Forum Jump:

User Panel Messages

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