Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError #2

Open
mjdup77 opened this issue Oct 29, 2019 · 0 comments
Open

KeyError #2

mjdup77 opened this issue Oct 29, 2019 · 0 comments

Comments

@mjdup77
Copy link

mjdup77 commented Oct 29, 2019

Hi there,

Apologies if this is a bit of a rookie question/request, I am new to programming and trying to learn as much as I can as I go.

I am having a problem with the Trend_Analysis_Complex.ipynb file, as I keep receiving this error:
(NOTE: I am looking at Corona instead of Facebook which you used in your example and am also trying to scrape in South Africa as opposed to the USA)

KeyError Traceback (most recent call last)
~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
2896 try:
-> 2897 return self._engine.get_loc(key)
2898 except KeyError:

pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: "Num of 'Corona' mentions"

During handling of the above exception, another exception occurred:

KeyError Traceback (most recent call last)
in
38 fig.add_trace(go.Scatter(
39 x=time_series,
---> 40 y=result["Num of '{}' mentions".format(settings.TRACK_WORDS[0])][result['polarity']==0].reset_index(drop=True),
41 name="Neutral",
42 opacity=0.8), row=1, col=1)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\frame.py in getitem(self, key)
2978 if self.columns.nlevels > 1:
2979 return self._getitem_multilevel(key)
-> 2980 indexer = self.columns.get_loc(key)
2981 if is_integer(indexer):
2982 indexer = [indexer]

~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
2897 return self._engine.get_loc(key)
2898 except KeyError:
-> 2899 return self._engine.get_loc(self._maybe_cast_indexer(key))
2900 indexer = self.get_indexer([key], method=method, tolerance=tolerance)
2901 if indexer.ndim > 1 or indexer.size > 1:

pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: "Num of 'Corona' mentions"

@mjdup77 mjdup77 changed the title KeyError? KeyError Oct 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant