-
Notifications
You must be signed in to change notification settings - Fork 44
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
data columns not returned as numeric #104
Comments
Yeah.... Iirc this was because of a change in pandas. They removed Should be a very simple change! |
Why do neither of these functions ( @ljwolf, it's looking to me like Also, @dfolch, how do you get colored syntax highlighting in your markdown? Is it because you copied from a notebook? |
Is there ever a case where you wouldn't want data columns to be of integer type? Of course, you never want the geography columns to be of a numeric type. |
Yes, fips codes for geographic identifiers ought to be kept as strings |
@ljwolf, how does one get the In
|
Could move |
@dfolch I'm pretty sure this takes care of the import issues. Should all of the functions that are now in In |
Is it the case that you want all or no data columns to be converted to integers or do you want to convert all of the ones that can be converted? |
I made If |
@ljwolf I'm sorry, I didn't see your comment until after I made the PR. I will work on this. What about the rest of the functions in |
some data columns should be float, not int -- most anything that has 'median', 'average' or 'rate' in the table name. I've used This gives some sense of the range of valid |
I've also since realized that the real problem is with the Census API, which returns numbers as quoted strings. JSON numbers shouldn't be quoted. See (and upvote) uscensusbureau/api#5 |
@JoeGermuska Would you still recommend using the Here's a quick solution doing just that (staged inside df = {some recently pulled data inside class ApiConnection}
type_dict = {
k: eval(self.variables.predicateType.loc[k.upper()])
for k in df.columns
}
df = df.astype(type_dict, errors='ignore') Note: This would also require some data cleansing of the
df.predicateType = df.predicateType.replace(['string', np.nan], 'str') |
Previous versions of cenpy retuned data columns as numeric values. Running that older code today returns objects. This is a feature request to go back to the previous approach.
The text was updated successfully, but these errors were encountered: