Closed rwijtvliet closed 1 year ago
If there is a work-around, I'd love to hear it. I currently have
def pintunit(q) -> str:
units = f"{q.units}" or 'dimensionless'
return f"pint[{units}]"
q2_as_series = pandas.Series(q2.magnitude, range(3), dtype=pintunit(q2)) # ok
The shortened form of the units of a dimensionless quantity is the empty string. But
"pint[]"
is not recognized as a validdtype
when constructing apandas.Series
. See final line in example below.If this is an issue specifically for
pint_pandas
, I can also file the bugreport there.