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

fips encoded as an int #3

Open
TomGoBravo opened this issue Jun 2, 2020 · 3 comments
Open

fips encoded as an int #3

TomGoBravo opened this issue Jun 2, 2020 · 3 comments

Comments

@TomGoBravo
Copy link

The DataFrame returned by the client has fips represented as an int64 but my understanding is they are better represented as 2 or 5 character strings. A quick fix that seems to work for me is df.fips = df.fips.apply(lambda v: f"{v:0>{2 if v < 100 else 5}}")

@cc7768
Copy link
Contributor

cc7768 commented Jun 3, 2020

Hi @TomGoBravo -- Thanks for pinging us.

I'm not particularly opinionated on this -- I believe we chose to use integers so

  1. We could do comparisons like fips < 100 => states or (fips > 6000) and (fips < 7000) => all CA counties (There could be other ways to do this as well though)
  2. It's a little less data to pass from database

Am I leaving anything out @sglyon?

Unless we have a more compelling reason than (1) or (2), I'm not opposed to just changing them at the database level which would make this change happen globally.

@sglyon
Copy link
Member

sglyon commented Jun 3, 2020

My preference is still to store them as int.

@TomGoBravo would it be helpful if we had a keyword arg on the client that is something like fips_as_str that would apply that transformation to the fips column on each request before returning the data frame?

@TomGoBravo
Copy link
Author

This is no big deal either way to me, just bringing up something I noticed.
In code I work on I'm trying to stick to an opaque string to identify a region and factor out logic that relates the regions to each other without depending on the structure of the region identifier.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants