1

I am trying to load a wikipedia table into a pandas dataframe, but I keep receiving an error notification ''NoneType' object has no attribute 'items''. I believe Python is importing the data as a list instead of a dataframe, but when I run df = data[0], i figured that was extracting a df. I've tried a few ways, but going with the simple code for now:

url = 'http://en.wikipedia.org/wiki/List_of_postal_codes_of_Canada:_M'
data = pd.read_html(url)
df = data[0]
df

when I check the type of df, pandas tells me its a dataframe (pandas.core.frame.dataframe) I consistently receive the following error message: error message

Thanks in advance.. having a tough time with this

1
  • it just works for me. python 3.7.6 pandas 1.1 Commented Aug 17, 2020 at 6:47

1 Answer 1

1

It seems that your data contains mixed types that pandas did not capture when loading the data from url. You may try adding low_memory=False when doing pd.read_html()

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.