Closed MichaelTiemannOSC closed 1 year ago
what versions are you using? I don't see this warning with {'numpy': '1.18.5', 'pandas': '1.3.5', 'pint': '0.18', 'pint_pandas': '0.2'}
I'm using {'numpy':'1.22.2', 'pandas':'1.4.1', 'pint':'0.18', 'pint':'0.18', 'pint_pandas': '0.2'}
I'm not sure if it is related, but I'm seeing the same warning without using the quantile function:
import pandas as pd
print(pd.Series([1., 2., 3.], dtype='pint[m]'))
output:
site-packages\pint_pandas\pint_array.py:648: UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
return np.array(qtys, dtype="object", copy=copy)
0 1.0
1 2.0
2 3.0
dtype: pint[m]
Also, the same warning appears on the doc : https://pint.readthedocs.io/en/0.18/pint-pandas.html
can you confirm this is still an issue with master? I can't reproduce {'numpy': '1.23.3', 'pandas': '1.5.1', 'pint': '0.20.1', 'pint_pandas': '0.3.dev101+gf5c74b1'}
I just tried it with master, and the warning has indeed disapearred.
{"numpy": "1.23.4", "pandas": "1.5.1", "pint": "0.20.1", "pint-pandas": "0.3.dev121+ge7584d5"}
While the Pandas folks consider a proposed fix for https://github.com/pandas-dev/pandas/issues/45968 I would also like to fix the unnecessary warning generated when using quantile in this way:
The text of the unnecessary warning is:
pint-pandas/pint_pandas/pint_array.py:658: UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
return np.array(qtys, dtype="object", copy=copy)
I expected the function
implement_consistent_units_by_argument
in pint/pint/numpu_func.py to be called for the quantile function, but I'm not seeing that. Maybe some other new pandas functionality is preempting that behavior? In any case, the warnings are a problem with hundreds of arrays we want to quantile...