Skip to content

Commit

Permalink
added conversion util for polars examples and removed commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-fong committed Aug 15, 2024
1 parent e8cacd6 commit 29d3f40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 0 additions & 3 deletions skpro/datatypes/_table/_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,6 @@ def convert_polars_to_pandas(obj, store=None):
if not isinstance(obj, (pl.LazyFrame, pl.DataFrame)):
raise TypeError("input is not a polars frame")

# if isinstance(obj, pl.LazyFrame):
# obj = obj.collect().to_pandas()
# elif isinstance(obj, pl.DataFrame):
obj = convert_polars_to_pandas_with_index(obj)

return obj
Expand Down
10 changes: 7 additions & 3 deletions skpro/datatypes/_table/_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,16 @@
example_dict_lossy[("list_of_dict", "Table", 0)] = False

if _check_soft_dependencies(["polars", "pyarrow"], severity="none"):
import polars as pl
from skpro.datatypes._adapter.polars import convert_pandas_to_polars_with_index

example_dict[("polars_eager_table", "Table", 0)] = pl.DataFrame(df)
example_dict[
("polars_eager_table", "Table", 0)
] = convert_pandas_to_polars_with_index(df)
example_dict_lossy[("polars_eager_table", "Table", 0)] = False

example_dict[("polars_lazy_table", "Table", 0)] = pl.LazyFrame(df)
example_dict[
("polars_lazy_table", "Table", 0)
] = convert_pandas_to_polars_with_index(df, lazy=True)
example_dict_lossy[("polars_lazy_table", "Table", 0)] = False

example_dict_metadata[("Table", 0)] = {
Expand Down

0 comments on commit 29d3f40

Please sign in to comment.