Python Forum
Cannot get output for df.head() - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Cannot get output for df.head() (/thread-37587.html)



Cannot get output for df.head() - Led_Zeppelin - Jun-28-2022

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