Open rjplevin opened 3 years ago
If you look at the code, this use case has been deprecated:
def __getitem__(self, item):
logger.warning(
"Calling the getitem method from a UnitRegistry is deprecated. "
"use `parse_expression` method or use the registry as a callable."
)
return self.parse_expression(item)
parse_expression
returns a Quantity.
I agree with you on this, and since this deprecation is like 5 years old, we can safely do something about it.
So we can either remove this function or change it.
This behavior seems to violate reasonable assumptions (and differs from the behavior of pandas, where
df['colname']
is the same asdf.colname
, presumingcolname
is a valid identifier.)If this is intentional, it's unclear why it makes sense for
ureg['year']
to return a Quantity.