Python Forum

Full Version: Cannot get output for df.head()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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