We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
pd.testing.assert_index_equal fails with pint dtype with check_exact=False. It works with the default check_exact=True.
pd.testing.assert_index_equal
pint
check_exact=False
check_exact=True
Code:
import pandas as pd import pint_pandas index_1 = index_2 = pd.Index(pd.Series([10, 20], dtype="pint[s]"), name="x") pd.testing.assert_index_equal(index_1, index_2, check_exact=False)
Error:
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[38], [line 5](vscode-notebook-cell:?execution_count=38&line=5) [2](vscode-notebook-cell:?execution_count=38&line=2) import pint_pandas [4](vscode-notebook-cell:?execution_count=38&line=4) index_1 = index_2 = pd.Index(pd.Series([10, 20], dtype="pint[s]"), name="x") ----> [5](vscode-notebook-cell:?execution_count=38&line=5) pd.testing.assert_index_equal(index_1, index_2, check_exact=False) [... skipping hidden 1 frame] File testing.pyx:55, in pandas._libs.testing.assert_almost_equal() File testing.pyx:160, in pandas._libs.testing.assert_almost_equal() File testing.pyx:145, in pandas._libs.testing.assert_almost_equal() File ~/draft/hdf/__venv__/lib/python3.12/site-packages/pint/facets/numpy/quantity.py:217, in NumpyQuantity.__len__(self) [216](https://file+.vscode-resource.vscode-cdn.net/home/vianney/draft/hdf/~/draft/hdf/__venv__/lib/python3.12/site-packages/pint/facets/numpy/quantity.py:216) def __len__(self) -> int: --> [217](https://file+.vscode-resource.vscode-cdn.net/home/vianney/draft/hdf/~/draft/hdf/__venv__/lib/python3.12/site-packages/pint/facets/numpy/quantity.py:217) return len(self._magnitude) TypeError: object of type 'numpy.int64' has no len()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
pd.testing.assert_index_equal
fails withpint
dtype withcheck_exact=False
. It works with the defaultcheck_exact=True
.Code:
Error:
The text was updated successfully, but these errors were encountered: