Closed redhog closed 1 year ago
An example usage with objects as magnitudes to store geographic positions:
Nice! Based on my recent experiences with making a similar change to experiment with UFloats, I like it!
You need to test some non float dtypes that you'd like to support
To test other dtypes, do something like this in test_pandas_extensiontests.py
_all_numeric_dtypes = [float, int]
@pytest.fixture(params=_all_numeric_dtypes)
def data(request):
return PintArray.from_1darray_quantity(np.arange(start=1.0, stop=101.0, dtype=request.param) * ureg.nm)
and change the rest of the fixtures to use the different dtypes too.
Will add tests and get back to you!
Realized I broke a bunch of tests. Have fixed all but one. Will fix that one too, then add the extra types as you requested.
there's a few tests that don't pass localy without my pandas forks. If you get the linting correct github will run the testsuite here
Tests now pass for complex128 dtype (and where that is not applicable, like divmod, are disabled for that dtype. @andrewgsavage Plase check if you think this is good enough for merging!
Btw, wrapped up the code that originally made me need this PR into a little library: https://github.com/redhog/print-proj It's so far a minimalistic/alpha version of a bridge between pint-pandas and geopandas...
I'm unsure how this will behave when mixing operations with floats and ints as that won't be tested in the pandas tests. Otherwise this looks good.
The tests fail in funny ways when some arrays are ints and others are floats (as opposed to all are one or the other)... Will have to look into how to make the tests behave tomorrow... But pretty sure the actual functionality is right, it's just the tests that are written assuming a simpler world...
I have now parametrized all test data to test for complex numbers. Note: No test tests for combining datasets with different dtypes. This is intentional; making that coerce nicely is outside of the scope of this PR in my opinion.
Yea that's fine. I'd like to get a version of pint-pandas released before merging this, then we can use this a bit to catch and fix those kind of issues.
@hgrecco could we get a pint-pandas 0.3 release?
Ping @andrewgsavage 0.3. is released, so... is this ready for merge then?
run pre-commit run --all-files to get linting working and add a note to changes
bors r+
pre-commit run --all-files
with no errors