Get dtypes from Schema #1356
Unanswered
chris-wright-nl
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hello! Assuming you have a DataframeSchema named
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
My final aim is to be able to enforce pandas to use specific data types at the point of ingestion i.e.:
df = pd.read_csv('my_data.csv', dtype = {'col1': str, 'col2': float, 'col3': int})
I would like to get the dtype from the schema model and then add a class method to the schema so that i can the do:
df = Schema.read_csv("foo.csv")
so far i can get the entries in the schema using:
entries = cls.__annotations__.items()
which returns
['col_1', pandera.typing.pandas.Series[pandas.core.arrays.integer.Int64Dtype]
but i'm having trouble accessing the pandas type.Any thoughts?
Beta Was this translation helpful? Give feedback.
All reactions