Create utilities module which is neccessary to fix #104#115
Create utilities module which is neccessary to fix #104#115rluedde wants to merge 11 commits intocenpy-devs:masterfrom
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.
| @@ -1,7 +1,10 @@ | |||
| from .utilities import _replace_missing as replace_missing_func | |||
There was a problem hiding this comment.
why are these private functions being made public here?
There was a problem hiding this comment.
They shouldn't be. I'll fix that in a few.
There was a problem hiding this comment.
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.pymodule had to be created to get away from a circular import situation. This way,_coercecan be used in bothremote.pyandproducts.pyI'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?