'NoneType' object has no attribute 'items'

I got this error on C1 / W1 exercice
import pandas as pd
import csv

df = pd.read_csv(’./womens_clothing_ecommerce_reviews.csv’
,index_col=0)

df.shape

df


AttributeError Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/IPython/core/formatters.py in call(self, obj)
343 method = get_real_method(obj, self.print_method)
344 if method is not None:
→ 345 return method()
346 return None
347 else:

/opt/conda/lib/python3.7/site-packages/pandas/core/frame.py in repr_html(self)
732 self.info(buf=buf)
733 return buf.getvalue()
→ 734
735 max_rows = get_option(“display.max_rows”)
736 min_rows = get_option(“display.min_rows”)

/opt/conda/lib/python3.7/site-packages/pandas/io/formats/format.py in to_html(self, buf, encoding, classes, notebook, border)
982 A border=border attribute is included in the opening
983 <table> tag. Default pd.options.display.html.border.
→ 984 “”"
985 from pandas.io.formats.html import HTMLFormatter, NotebookFormatter
986

/opt/conda/lib/python3.7/site-packages/pandas/io/formats/html.py in init(self, formatter, classes, border)
57 self.col_space = {
58 column: f"{value}px" if isinstance(value, int) else value
—> 59 for column, value in self.fmt.col_space.items()
60 }
61

AttributeError: ‘NoneType’ object has no attribute ‘items’

Make sure to run this command:

!aws s3 cp s3://dlai-practical-data-science/data/raw/womens_clothing_ecommerce_reviews.csv ./womens_clothing_ecommerce_reviews.csv

It is in the cell above.

I just stopped and restarted the Jupiter notebook, and things were fine - may be an environment issue,

1 Like