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 when using the "state" parameter in jhu "get_new" and "get_total_confirmed_deaths_recovered" methods #59

Open
ada-k opened this issue Nov 21, 2020 · 3 comments

Comments

@ada-k
Copy link

ada-k commented Nov 21, 2020

Hello,
I'm trying to fetch data from JHU using the jhu class in data_retrival/_JHU.py. When I use the state argument in the methods get_new and get_total_confirmed_deaths_recovered, I get the error below. I've tried different formats for the state argument including: california, California, CA, CALIFORNIA, Calif., AZ, Arizona, Ariz.. I'm not sure what I'm missing, maybe someone can take a look.


---------------------------------------------------------------------------

KeyError                                  Traceback (most recent call last)

/usr/local/lib/python3.6/dist-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
   2894             try:
-> 2895                 return self._engine.get_loc(casted_key)
   2896             except KeyError as err:

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: 'CA'


The above exception was the direct cause of the following exception:

KeyError                                  Traceback (most recent call last)

pandas/_libs/index.pyx in pandas._libs.index.BaseMultiIndexCodesEngine.get_loc()

5 frames

KeyError: 'CA'


During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)

/usr/local/lib/python3.6/dist-packages/pandas/core/indexes/multi.py in get_loc(self, key, method)
   2712 
   2713         if keylen == self.nlevels and self.is_unique:
-> 2714             return self._engine.get_loc(key)
   2715 
   2716         # -- partial selection or non-unique index

pandas/_libs/index.pyx in pandas._libs.index.BaseMultiIndexCodesEngine.get_loc()

KeyError: ('US', 'CA')
@semohr
Copy link
Member

semohr commented Nov 23, 2020

Sadly there are no US states in the global data file from the JHU. One has to download an additional file for that i.e. this.

Would take some time and additional logic to add the file to the data retriever.
I will take a look at it at a later point in time.

@ada-k
Copy link
Author

ada-k commented Dec 3, 2020

Alright.
Thank you for the timely response.

@semohr
Copy link
Member

semohr commented Dec 3, 2020

No problem! Thanks for your interest in our work.
I will keep this issue open, maybe I will get to it at some time.

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

2 participants