unionai-oss / pandera

A light-weight, flexible, and expressive statistical data testing library
https://www.union.ai/pandera
MIT License
3.05k stars 281 forks source link

Is there a way to get a `DataFrameModel` from existing `pandas.DataFrame`? #1578

Open Felix-neko opened 1 month ago

Felix-neko commented 1 month ago

Hi folks! And thank you for your project.

I want to use pandera to validate input dataframes of data transformation functions I have to write -- and I have a question.

Is it possible to generate a DataFrameModel from existing pandas.DataFrame?

Something like infer_schema(...), but infer_model(...)?

Is it possible?

westurner commented 1 month ago
kykyi commented 3 weeks ago

@Felix-neko I don't think this is possible atm, just to check, would this be to programatically ensure different dataframes follow the same schema, or would this be to get a dataframe, extract the schema, and save it to a file?