-
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
Create utilities module which is neccessary to fix #104 #115
base: master
Are you sure you want to change the base?
Conversation
There were functions in products.py that will be useful in other modules but circular imports pop up if these functions don't have their own module.
_ACS_MISSING only gets used once (in a function that's now in utilities.py so I moved this variable into that function. I don't think that these missing values ever change
If one of the columns can' be converted, none of the columns get converted.
utilities._coerce used to take in an object and try to change the entire object's dtype. Now, it changes only what columns can be changeable. For example, if there's a column of words and column of integers, coerce cam now cast only the column of integers to type integer and leave the column of words as pandas objects. Add unit tests for coerce.
Add tests
For all of the |
Most of cenpy uses the |
replace_missing (the argument) had the same name as replace_missing (the function)
Fixes #104: >>> import cenpy as cen
>>> api_conn = cen.remote.APIConnection('ACSDT5Y2018')
>>> data = api_conn.query(['B01003_001E'], geo_unit='tract', geo_filter={'state':'04', 'county':'005'})
>>> data.B01003_001E.dtype
dtype('int64') Addresses #114 . Adds tests for I think this PR is ready for review! |
This fix likely causes a lot of other issues with functions in this module. Tests will probably be a good idea at some point here.
cenpy/products.py
Outdated
@@ -1,7 +1,10 @@ | |||
from .utilities import _replace_missing as replace_missing_func |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are these private functions being made public here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They shouldn't be. I'll fix that in a few.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I addressed this in my most recent commit.
I goofed here. That merge commit shouldn't have been done and I don't know how to fix it without doing damage. While it does incorporate functionality that is useful, it's not within the scope of this PR. How do I remove that merge commit? It looks like it's possible to remove the most recent commit but I haven't found anything about removing non-most-recent commits. |
See here for
|
Fixes #104.
utilities.py
module had to be created to get away from a circular import situation. This way,_coerce
can be used in bothremote.py
andproducts.py
I'd like to be able to test these changes to make sure that I didn't blow anything up. How should I go about doing this? Run the test suite? Write some unit tests?