Skip to content

Commit

Permalink
Revert pandas warning filter
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Jan 21, 2024
1 parent 988a15a commit 45a9db7
Showing 1 changed file with 7 additions and 26 deletions.
33 changes: 7 additions & 26 deletions py-polars/polars/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import contextlib
import os
import random
import warnings
from collections import OrderedDict, defaultdict
from collections.abc import Sized
from io import BytesIO, StringIO, TextIOWrapper
Expand Down Expand Up @@ -2290,33 +2289,15 @@ def to_pandas( # noqa: D417
record_batches = self._df.to_pandas()
tbl = pa.Table.from_batches(record_batches)
if use_pyarrow_extension_array:
with warnings.catch_warnings():
# Needs fixing upstream in pyarrow
# Silence here as it's something Polars users can't do
# anything about.
warnings.filterwarnings(
"ignore",
message="make_block is deprecated and will be removed",
category=DeprecationWarning,
)
return tbl.to_pandas(
self_destruct=True,
split_blocks=True,
types_mapper=lambda pa_dtype: pd.ArrowDtype(pa_dtype),
**kwargs,
)
return tbl.to_pandas(
self_destruct=True,
split_blocks=True,
types_mapper=lambda pa_dtype: pd.ArrowDtype(pa_dtype),
**kwargs,
)

date_as_object = kwargs.pop("date_as_object", False)
with warnings.catch_warnings():
# Needs fixing upstream in pyarrow
# Silence here as it's something Polars users can't do
# anything about.
warnings.filterwarnings(
"ignore",
message="make_block is deprecated and will be removed",
category=DeprecationWarning,
)
return tbl.to_pandas(date_as_object=date_as_object, **kwargs)
return tbl.to_pandas(date_as_object=date_as_object, **kwargs)

def to_series(self, index: int = 0) -> Series:
"""
Expand Down

0 comments on commit 45a9db7

Please sign in to comment.