Skip to content
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

Filter all DeprecationWarning's by ArrowTable.to_pandas() #14989

Merged
merged 12 commits into from
Feb 7, 2024
12 changes: 11 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,17 @@ repos:
# DeprecationWarning: https://github.com/pandas-dev/pandas/issues/54970
exclude: |
(?x)^(
^python/cudf/cudf/core/dtypes.py
^python/cudf/cudf/core/dtypes.py|
^python/cudf/cudf/tests/test_avro_reader_fastavro_integration.py|
^python/cudf/cudf/tests/test_dataframe.py|
^python/cudf/cudf/tests/test_datetime.py|
^python/cudf/cudf/tests/test_feather.py|
^python/cudf/cudf/tests/test_groupby.py|
^python/cudf/cudf/tests/test_orc.py|
^python/cudf/cudf/tests/test_parquet.py|
^python/cudf/cudf/tests/test_rolling.py|
^python/cudf/cudf/tests/test_s3.py|
^python/cudf/cudf/tests/test_index.py
)
- id: no-programmatic-xfail
name: no-programmatic-xfail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@
import pytest

import cudf
from cudf.core._compat import PANDAS_GE_220
galipremsagar marked this conversation as resolved.
Show resolved Hide resolved
from cudf.testing._utils import assert_eq
from cudf.testing.dataset_generator import rand_dataframe

if PANDAS_GE_220:
pytestmark = pytest.mark.filterwarnings(
"ignore",
category=DeprecationWarning,
message="Passing a BlockManager to DataFrame is deprecated",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cudf never deals with the pandas block manager right? If not, I would just globally ignore this in python/cudf/cudf/tests/pytest.ini with ignore:Passing a BlockManager to DataFrame is deprecated:DeprecationWarning

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't deal with it, it shows up every time when we do:

arrow_table = pa.table(...)
arrow_table.to_pandas()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, moved the filter to pytest.ini

)

galipremsagar marked this conversation as resolved.
Show resolved Hide resolved

def cudf_from_avro_util(schema: dict, records: list) -> cudf.DataFrame:
schema = [] if schema is None else fastavro.parse_schema(schema)
Expand Down
19 changes: 17 additions & 2 deletions python/cudf/cudf/tests/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@

import cudf
from cudf.api.extensions import no_default
from cudf.core._compat import PANDAS_GE_200, PANDAS_GE_210, PANDAS_LT_203
from cudf.core._compat import (
PANDAS_GE_200,
PANDAS_GE_210,
PANDAS_GE_220,
PANDAS_LT_203,
)
galipremsagar marked this conversation as resolved.
Show resolved Hide resolved
from cudf.core.buffer.spill_manager import get_global_manager
from cudf.core.column import column
from cudf.errors import MixedTypeError
Expand All @@ -43,7 +48,17 @@
)

pytest_xfail = pytest.mark.xfail
pytestmark = pytest.mark.spilling
pytestmark = [pytest.mark.spilling]

if PANDAS_GE_220:
pytestmark.append(
pytest.mark.filterwarnings(
"ignore",
category=DeprecationWarning,
message="Passing a BlockManager to DataFrame is deprecated",
)
)

galipremsagar marked this conversation as resolved.
Show resolved Hide resolved

# Use this to "unmark" the module level spilling mark
pytest_unmark_spilling = pytest.mark.skipif(
Expand Down
7 changes: 7 additions & 0 deletions python/cudf/cudf/tests/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@
operator.ne,
]

if PANDAS_GE_220:
pytestmark = pytest.mark.filterwarnings(
"ignore",
category=DeprecationWarning,
message="Passing a BlockManager to DataFrame is deprecated",
)

galipremsagar marked this conversation as resolved.
Show resolved Hide resolved

def data1():
return pd.date_range("20010101", "20020215", freq="400h", name="times")
Expand Down
10 changes: 9 additions & 1 deletion python/cudf/cudf/tests/test_feather.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018-2023, NVIDIA CORPORATION.
# Copyright (c) 2018-2024, NVIDIA CORPORATION.

galipremsagar marked this conversation as resolved.
Show resolved Hide resolved
import os
from string import ascii_letters
Expand All @@ -9,8 +9,16 @@
import pytest

import cudf
from cudf.core._compat import PANDAS_GE_220
from cudf.testing._utils import NUMERIC_TYPES, assert_eq
galipremsagar marked this conversation as resolved.
Show resolved Hide resolved

if PANDAS_GE_220:
pytestmark = pytest.mark.filterwarnings(
"ignore",
category=DeprecationWarning,
message="Passing a BlockManager to DataFrame is deprecated",
)


galipremsagar marked this conversation as resolved.
Show resolved Hide resolved
@pytest.fixture(params=[0, 1, 10, 100])
def pdf(request):
Expand Down
9 changes: 8 additions & 1 deletion python/cudf/cudf/tests/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import cudf
from cudf import DataFrame, Series
from cudf.api.extensions import no_default
from cudf.core._compat import PANDAS_GE_200, PANDAS_GE_210
from cudf.core._compat import PANDAS_GE_200, PANDAS_GE_210, PANDAS_GE_220
galipremsagar marked this conversation as resolved.
Show resolved Hide resolved
from cudf.core.udf._ops import arith_ops, comparison_ops, unary_ops
from cudf.core.udf.groupby_typing import SUPPORTED_GROUPBY_NUMPY_TYPES
from cudf.core.udf.utils import UDFError, precompiled
Expand All @@ -40,6 +40,13 @@
_tomorrow = np.int64(_tomorrow.astype("datetime64[ns]"))
_index_type_aggs = {"count", "idxmin", "idxmax", "cumcount"}

if PANDAS_GE_220:
pytestmark = pytest.mark.filterwarnings(
"ignore",
category=DeprecationWarning,
message="Passing a BlockManager to DataFrame is deprecated",
)

galipremsagar marked this conversation as resolved.
Show resolved Hide resolved

def assert_groupby_results_equal(
expect, got, sort=True, as_index=True, by=None, **kwargs
Expand Down
9 changes: 8 additions & 1 deletion python/cudf/cudf/tests/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import cudf
from cudf.api.extensions import no_default
from cudf.api.types import is_bool_dtype
from cudf.core._compat import PANDAS_GE_200
from cudf.core._compat import PANDAS_GE_200, PANDAS_GE_220
galipremsagar marked this conversation as resolved.
Show resolved Hide resolved
from cudf.core.index import (
CategoricalIndex,
DatetimeIndex,
Expand All @@ -39,6 +39,13 @@
)
from cudf.utils.utils import search_range

if PANDAS_GE_220:
pytestmark = pytest.mark.filterwarnings(
"ignore",
category=DeprecationWarning,
message="Passing a BlockManager to DataFrame is deprecated",
)

galipremsagar marked this conversation as resolved.
Show resolved Hide resolved

def test_df_set_index_from_series():
df = cudf.DataFrame()
Expand Down
26 changes: 19 additions & 7 deletions python/cudf/cudf/tests/test_orc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import pytest

import cudf
from cudf.core._compat import PANDAS_GE_220
galipremsagar marked this conversation as resolved.
Show resolved Hide resolved
from cudf.io.orc import ORCWriter
from cudf.testing import assert_frame_equal
from cudf.testing._utils import (
Expand All @@ -22,13 +23,24 @@
supported_numpy_dtypes,
)

# Removal of these deprecated features is no longer imminent. They will not be
# removed until a suitable alternative has been implemented. As a result, we
# also do not want to stop testing them yet.
# https://github.com/rapidsai/cudf/issues/11519
pytestmark = pytest.mark.filterwarnings(
"ignore:(num_rows|skiprows) is deprecated and will be removed."
)
pytestmark = [
# Removal of these deprecated features is no longer imminent. They will not be
# removed until a suitable alternative has been implemented. As a result, we
# also do not want to stop testing them yet.
# https://github.com/rapidsai/cudf/issues/11519
pytest.mark.filterwarnings(
"ignore:(num_rows|skiprows) is deprecated and will be removed."
galipremsagar marked this conversation as resolved.
Show resolved Hide resolved
)
]

if PANDAS_GE_220:
pytestmark.append(
pytest.mark.filterwarnings(
"ignore",
category=DeprecationWarning,
message="Passing a BlockManager to DataFrame is deprecated",
)
)
galipremsagar marked this conversation as resolved.
Show resolved Hide resolved


@pytest.fixture(scope="module")
Expand Down
9 changes: 8 additions & 1 deletion python/cudf/cudf/tests/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from pyarrow import fs as pa_fs, parquet as pq

import cudf
from cudf.core._compat import PANDAS_GE_200
from cudf.core._compat import PANDAS_GE_200, PANDAS_GE_220
galipremsagar marked this conversation as resolved.
Show resolved Hide resolved
from cudf.io.parquet import (
ParquetDatasetWriter,
ParquetWriter,
Expand All @@ -34,6 +34,13 @@
set_random_null_mask_inplace,
)

if PANDAS_GE_220:
pytestmark = pytest.mark.filterwarnings(
"ignore",
category=DeprecationWarning,
message="Passing a BlockManager to DataFrame is deprecated",
)

galipremsagar marked this conversation as resolved.
Show resolved Hide resolved

@contextmanager
def _hide_pyarrow_parquet_cpu_warnings(engine):
Expand Down
9 changes: 8 additions & 1 deletion python/cudf/cudf/tests/test_rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@
import pytest

import cudf
from cudf.core._compat import PANDAS_GE_200
from cudf.core._compat import PANDAS_GE_200, PANDAS_GE_220
galipremsagar marked this conversation as resolved.
Show resolved Hide resolved
from cudf.testing._utils import assert_eq
from cudf.testing.dataset_generator import rand_dataframe

if PANDAS_GE_220:
pytestmark = pytest.mark.filterwarnings(
"ignore",
category=DeprecationWarning,
message="Passing a BlockManager to DataFrame is deprecated",
)

galipremsagar marked this conversation as resolved.
Show resolved Hide resolved

@contextmanager
def _hide_pandas_rolling_min_periods_warning(agg):
Expand Down
7 changes: 7 additions & 0 deletions python/cudf/cudf/tests/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@
from fsspec.core import get_fs_token_paths

import cudf
from cudf.core._compat import PANDAS_GE_220
galipremsagar marked this conversation as resolved.
Show resolved Hide resolved
from cudf.testing._utils import assert_eq

moto = pytest.importorskip("moto", minversion="3.1.6")
boto3 = pytest.importorskip("boto3")
s3fs = pytest.importorskip("s3fs")

ThreadedMotoServer = pytest.importorskip("moto.server").ThreadedMotoServer
if PANDAS_GE_220:
pytestmark = pytest.mark.filterwarnings(
"ignore",
category=DeprecationWarning,
message="Passing a BlockManager to DataFrame is deprecated",
)
galipremsagar marked this conversation as resolved.
Show resolved Hide resolved


@pytest.fixture(scope="session")
Expand Down
Loading