Skip to content

Commit

Permalink
refactor(python): Revert pandas warning filter (pola-rs#13893)
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego authored and r-brink committed Jan 24, 2024
1 parent fc3761d commit 35c5598
Show file tree
Hide file tree
Showing 2 changed files with 16 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
9 changes: 9 additions & 0 deletions py-polars/tests/unit/io/test_hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
from polars.testing import assert_frame_equal


@pytest.mark.skip(
reason="Broken by pyarrow 15 release: https://github.com/pola-rs/polars/issues/13892"
)
@pytest.mark.write_disk()
def test_hive_partitioned_predicate_pushdown(
io_files_path: Path, tmp_path: Path, monkeypatch: Any, capfd: Any
Expand Down Expand Up @@ -85,6 +88,9 @@ def test_hive_partitioned_predicate_pushdown_skips_correct_number_of_files(
assert "hive partitioning: skipped 3 files" in capfd.readouterr().err


@pytest.mark.skip(
reason="Broken by pyarrow 15 release: https://github.com/pola-rs/polars/issues/13892"
)
@pytest.mark.write_disk()
def test_hive_partitioned_slice_pushdown(io_files_path: Path, tmp_path: Path) -> None:
df = pl.read_ipc(io_files_path / "*.ipc")
Expand Down Expand Up @@ -118,6 +124,9 @@ def test_hive_partitioned_slice_pushdown(io_files_path: Path, tmp_path: Path) ->
]


@pytest.mark.skip(
reason="Broken by pyarrow 15 release: https://github.com/pola-rs/polars/issues/13892"
)
@pytest.mark.write_disk()
def test_hive_partitioned_projection_pushdown(
io_files_path: Path, tmp_path: Path
Expand Down

0 comments on commit 35c5598

Please sign in to comment.