Closed deeplook closed 2 years ago
I have a simple function I want to use on a dataframe's rows with df.apply(), say:
df.apply()
def func(col1, col2): return 2 * (col1 * col2) - Q_("5 kg")
But I get this error because this mixes two unit registries, so the question is how to access the one inside the dataframe?
ValueError: Cannot operate with Quantity and Quantity of different registries.
Solved it using sth. like pint_pandas.PintType.ureg = ureg as suggested in https://github.com/hgrecco/pint-pandas/blob/master/notebooks/pint-pandas.ipynb.
pint_pandas.PintType.ureg = ureg
I have a simple function I want to use on a dataframe's rows with
df.apply()
, say:But I get this error because this mixes two unit registries, so the question is how to access the one inside the dataframe?
ValueError: Cannot operate with Quantity and Quantity of different registries.