Skip to content
Advertisement

I cant find why `.read_csv` cannot make a dataframe for `.shape` to recognize

Following a machine learning guide here: https://www.pluralsight.com/guides/scikit-machine-learning/

Running Python 3.8, might have a hunch that I need to run it in IPython but I think that opens up a new can of worms.

Also have all imported these libraries installed.

I left %matplotlib inline as a comment because i’m not running it in Jupyter.

JavaScript

The error I get when running this code is:

Traceback (most recent call last): File “scikitmlprac.py”, line 12, in print(pd.shape) File “C:Python38libsite-packagespandas_init_.py”, line 258, in getattr raise AttributeError(f”module ‘pandas’ has no attribute ‘{name}'”) AttributeError: module ‘pandas’ has no attribute ‘shape’

Advertisement

Answer

Seems like you just have a typo here. You’ve tried to print pd.shape when it should be df.shape. Hence the error.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement