Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion skrub/_dataframe/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,22 @@ def _to_pandas_pandas(obj):
return obj


@to_pandas.specialize("polars")
@to_pandas.specialize("polars", argument_type="DataFrame")
def _to_pandas_polars(obj):
return obj.to_pandas()


@to_pandas.specialize("polars", argument_type="Column")
def _to_pandas_polars_column(obj):
"""Convert a polars Series to a pandas Series, through numpy when pyarrow is not
installed."""
try:
return obj.to_pandas()
except ImportError:
Comment thread
jeromedockes marked this conversation as resolved.
# pyarrow is needed for polars .to_pandas() and may not be installed
return pd.Series(to_numpy(obj))


@dispatch
def make_dataframe_like(obj, data):
"""Create a dataframe from `data` using the module of `obj`.
Expand Down