-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
It would be a nice feature to be able generate the code of a Schema based on polars DataFrame.
(like datamodel-codegen)
Here is an example to illustrate:
>>> import polars as pl
>>> import dataframely as dy
>>> df = pl.DataFrame({
"zip_code": ["01234", "01234", "1", "213", "123", "213"],
"num_bedrooms": [2, 2, 1, None, None, 2],
"num_bathrooms": [1, 2, 1, 1, 0, 8],
"price": [100.1, 110.1, 50.1, 80.1, 60.1, 160.1]
})
>>> from dataframely import generate_schema
>>> generate_schema(df, schema_name = "HouseSchema") # a string is printed
# class HouseSchema(dy.Schema):
# zip_code = dy.String()
# num_bedrooms = dy.Int64(nullable=True)
# num_bathrooms = dy.Int64()
# price = dy.Float64()Metadata
Metadata
Assignees
Labels
No labels