-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENH] Polars conversion utilities #6455
Conversation
4ad79c7
to
245d820
Compare
I'm thinking to add a check in the obj.index = obj.index.to_timestamp() So we have two solutions now
I ran into this error when trying to convert the load_airline dataset into polars. Also I would like to know if I can create a deepcopy of the pandas obj being passed as we are renaming the index columns of the dataframe which in turn changes the index names of the original pandas dataframe too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me - we may have to change these loose converters in later PR when we integrate, but that will be easily possible given that this is still all private.
Adds conversion functions from polars to pandas and vice versa, with relevant tests for the functions. sktime#5423
adds index support as part of #440 and is used to sync up polars conversion utilities between skpro and sktime. Correponding sktime pr for polars conversion utilities is sktime/sktime#6455. In this pr: If a pandas Dataframe is a `from_type` and polars frame is a `to_type` then during the conversion, we will save the index (assumed never to be in multi-index format) and insert it as an individual column with column name `__index__`. Then the resulting pandas dataframe will be converted to a polars dataframe. In the inverse function, if we are converting from polars dataframe to pandas dataframe, if the column `__index__` exists in the pandas dataframe post-conversion, then we will map that column to the index before returning the pandas Dataframe After this is merged, #447 will be implemented as a `polars` only estimator. tests will also be written to check polars input end to end and pandas input and output through the polars estimator (i.e pandas input into polars estimator -> polars predictions -> pandas output)
Adds conversion functions from polars to pandas and vice versa, with relevant tests for the functions.
#5423