dlab-berkeley / Python-Web-Scraping-Legacy

D-Lab's 3 hour introduction to web scraping in Python. Learn how to use APIs and scrape data from websites using the New York Times API and BeautifulSoup in Python.
7 stars 3 forks source link

Reading in election2020_articles.pkl ERROR #28

Open Severrinn opened 2 years ago

Severrinn commented 2 years ago

Notebook 1. The code below returns this error

df = pd.read_pickle("../data/election2020_articles.pkl") df.head()


AttributeError Traceback (most recent call last)

in ----> 1 df = pd.read_pickle("../data/election2020_articles.pkl") 2 df.head() /Applications/anaconda3/lib/python3.8/site-packages/pandas/io/pickle.py in read_pickle(filepath_or_buffer, compression, storage_options) 206 # "No module named 'pandas.core.sparse.series'" 207 # "Can't get attribute '__nat_unpickle' on 208 return pc.load(handles.handle, encoding=None) 209 except UnicodeDecodeError: 210 # e.g. can occur for files written in py27; see GH#28645 and GH#31988 /Applications/anaconda3/lib/python3.8/site-packages/pandas/compat/pickle_compat.py in load(fh, encoding, is_verbose) 247 up.is_verbose = is_verbose 248 --> 249 return up.load() 250 except (ValueError, TypeError): 251 raise /Applications/anaconda3/lib/python3.8/pickle.py in load(self) 1210 raise EOFError 1211 assert isinstance(key, bytes_types) -> 1212 dispatch[key[0]](self) 1213 except _Stop as stopinst: 1214 return stopinst.value /Applications/anaconda3/lib/python3.8/pickle.py in load_stack_global(self) 1535 if type(name) is not str or type(module) is not str: 1536 raise UnpicklingError("STACK_GLOBAL requires str") -> 1537 self.append(self.find_class(module, name)) 1538 dispatch[STACK_GLOBAL[0]] = load_stack_global 1539 /Applications/anaconda3/lib/python3.8/site-packages/pandas/compat/pickle_compat.py in find_class(self, module, name) 187 key = (module, name) 188 module, name = _class_locations_map.get(key, key) --> 189 return super().find_class(module, name) 190 191 /Applications/anaconda3/lib/python3.8/pickle.py in find_class(self, module, name) 1579 __import__(module, level=0) 1580 if self.proto >= 4: -> 1581 return _getattribute(sys.modules[module], name)[0] 1582 else: 1583 return getattr(sys.modules[module], name) /Applications/anaconda3/lib/python3.8/pickle.py in _getattribute(obj, name) 329 obj = getattr(obj, subpath) 330 except AttributeError: --> 331 raise AttributeError("Can't get attribute {!r} on {!r}" 332 .format(name, obj)) from None 333 return obj, parent AttributeError: Can't get attribute 'new_block' on