JakobGM / patito

A data modelling layer built on top of polars and pydantic
MIT License
252 stars 23 forks source link

bug: TypeError: LazyFrame.collect() got an unexpected keyword argument '_eager' when using function patito.Model.examples() #36

Open jumper-m opened 7 months ago

jumper-m commented 7 months ago

It seems like patito.Model.examples() is not working. For testing I just installed Patito in a new venv. Running the following code

import patito as pt

class Bids(pt.Model):
    offer_id: str = pt.Field(alias='Offer-ID', unique=True)
    country_eic: str = pt.Field(alias='Country-EIC')
    power: int = pt.Field(alias="Power")

if __name__=='__main__':

    print(Bids.examples({"Offer-ID": ["a1","a2","a3"]}))

gives me the following error

Traceback (most recent call last): File "C:\Users\ANON\python\test_proj\models.py", line 27, in print(Bids.examples({"Offer-ID": ["a1","a2","a3"]})) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ANON\python\test_proj\venv\Lib\site-packages\patito\pydantic.py", line 1033, in examples return DataFrame().with_columns(series).with_columns(unique_series) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ANON\python\test_proj\venv\Lib\site-packages\patito\polars.py", line 703, in with_columns return cast(DF, super().with_columns(*exprs, *named_exprs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ANON\python\test_proj\venv\Lib\site-packages\polars\dataframe\frame.py", line 8270, in with_columns return self.lazy().with_columns(exprs, **named_exprs).collect(_eager=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: LazyFrame.collect() got an unexpected keyword argument '_eager'

With pip install patito following packages were installed: