Priesemann-Group / covid19_inference

Bayesian python toolbox for inference and forecast of the spread of the Coronavirus
GNU General Public License v3.0
73 stars 70 forks source link

KeyError when using the "state" parameter in jhu "get_new" and "get_total_confirmed_deaths_recovered" methods #59

Open ada-k opened 4 years ago

ada-k commented 4 years ago

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 commented 4 years ago

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 commented 3 years ago

Alright. Thank you for the timely response.

semohr commented 3 years ago

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