Skip to content
This repository was archived by the owner on Aug 1, 2020. It is now read-only.
This repository was archived by the owner on Aug 1, 2020. It is now read-only.

"Simple Example: Single dataset for all counties in a state" raises an error #15

@QBatista

Description

@QBatista

Problem Description

The following simple example from the client library raises an error with requests 2.23.0, pandas 1.0.3, us 2.0.2 and email_validator 1.1.1:

from cmdc import Client

c = Client()
c.demographics(state=48)
df = c.fetch()

Traceback

Details
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-2902c67eda5b> in <module>
      3 
      4 c = Client()
----> 5 c.demographics(state=48)
      6 df = c.fetch()

/anaconda3/lib/python3.7/site-packages/cmdc/client.py in __call__(self, state, **filters)
     71                 raise ValueError(msg)
     72 
---> 73             filters["fips"] = self.client.fips_in_states(state)
     74 
     75         # process filters

/anaconda3/lib/python3.7/site-packages/cmdc/client.py in fips_in_states(self, states)
    204             states = [states]
    205         states = [int(us.states.lookup(str(x).zfill(2)).fips) for x in states]
--> 206         fips = self.counties.query("state in @states")["fips"].unique()
    207         return sorted(list(fips)) + states
    208 

/anaconda3/lib/python3.7/site-packages/cmdc/client.py in counties(self)
    191             res = self.sess.get(BASE_URL + "/counties")
    192             if not res.ok:
--> 193                 raise ValueError("Failed to get list of counties")
    194 
    195             self._counties = pd.DataFrame(res.json())

ValueError: Failed to get list of counties

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions