Python Forum

Full Version: numpy.array has no attribute head
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
I got this it is easy to change numpy.array to dataframe.

I think that will do it.

Respectfully,

LZ