seandstewart / typical

Typical: Fast, simple, & correct data-validation using Python 3 typing.
https://python-typical.org
MIT License
183 stars 9 forks source link

Not compatible with pandas v1.3.3 #174

Closed xbanke closed 2 years ago

xbanke commented 2 years ago

Description

I update pandas from 1.2.3 to 1.3.3, it gives weird transmuted result when annotated pandas.DataFrame or pandas.Series.

import typic, pandas as pd

proto = typic.protocol(pd.DataFrame)  # typic\util.py:479: UserWarning: Couldn't evaluate type ForwardRef('typing.Union[weakref.ReferenceType[NDFrame],None]'): 'type' object is not subscriptable  warnings.warn(f"Couldn't evaluate type {value!r}: {e}")

proto.transmute(1)  # it should raise ValueError, but gives the following weird result.
   0
0  1
1  2
2  3
seandstewart commented 2 years ago

@xbanke please try the branch for #175 - I believe this issue should be resolved.

xbanke commented 2 years ago

yes, it fix this issue, thx