Skip to content

Commit

Permalink
Drop less than Pandas-1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
galipremsagar committed Nov 10, 2022
1 parent 2038276 commit ec43524
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 65 deletions.
1 change: 0 additions & 1 deletion python/cudf/cudf/core/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from packaging import version

PANDAS_VERSION = version.parse(pd.__version__)
PANDAS_GE_100 = PANDAS_VERSION >= version.parse("1.0")
PANDAS_GE_110 = PANDAS_VERSION >= version.parse("1.1")
PANDAS_GE_120 = PANDAS_VERSION >= version.parse("1.2")
PANDAS_LE_122 = PANDAS_VERSION <= version.parse("1.2.2")
Expand Down
10 changes: 0 additions & 10 deletions python/cudf/cudf/testing/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@
import cupy
import numpy as np
import pandas as pd
import pyarrow as pa
import pyarrow.orc
import pytest
from pandas import testing as tm

import cudf
from cudf._lib.null_mask import bitmask_allocation_size_bytes
from cudf.core._compat import PANDAS_GE_100
from cudf.core.column.timedelta import _unit_to_nanoseconds_conversion
from cudf.utils import dtypes as dtypeutils

Expand Down Expand Up @@ -382,13 +379,6 @@ def _create_pandas_series(data=None, index=None, dtype=None, *args, **kwargs):
return pd.Series(data=data, index=index, dtype=dtype, *args, **kwargs)


def _pandas_read_orc(fname, columns=None):
if PANDAS_GE_100:
return pd.read_orc(fname, columns=columns)
else:
return pa.orc.ORCFile(fname).read(columns=columns).to_pandas()


parametrize_numeric_dtypes_pairwise = pytest.mark.parametrize(
"left_dtype,right_dtype",
list(itertools.combinations_with_replacement(NUMERIC_TYPES, 2)),
Expand Down
4 changes: 2 additions & 2 deletions python/cudf/cudf/tests/test_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest

import cudf
from cudf.testing._utils import _pandas_read_orc, assert_eq
from cudf.testing._utils import assert_eq

gcsfs = pytest.importorskip("gcsfs")

Expand Down Expand Up @@ -69,5 +69,5 @@ def mock_open(*args, **kwargs):
monkeypatch.setattr(gcsfs.core.GCSFileSystem, "open", mock_open)
gdf.to_orc(f"gcs://{gcs_fname}")

got = _pandas_read_orc(local_filepath)
got = pd.read_orc(local_filepath)
assert_eq(pdf, got)
6 changes: 3 additions & 3 deletions python/cudf/cudf/tests/test_hdfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import pytest

import cudf
from cudf.testing._utils import _pandas_read_orc, assert_eq
from cudf.testing._utils import assert_eq

if not os.environ.get("RUN_HDFS_TESTS"):
pytestmark = pytest.mark.skip("Env not configured to run HDFS tests")
Expand Down Expand Up @@ -211,7 +211,7 @@ def test_read_orc(datadir, hdfs, test_url):
hd_fpath = f"hdfs://{basedir}/file.orc"

got = cudf.read_orc(hd_fpath)
expect = _pandas_read_orc(buffer)
expect = pd.read_orc(buffer)
assert_eq(expect, got)


Expand All @@ -231,7 +231,7 @@ def test_write_orc(pdf, hdfs, test_url):

assert hdfs.exists(f"{basedir}/test_orc_writer.orc")
with hdfs.open(f"{basedir}/test_orc_writer.orc", mode="rb") as f:
got = _pandas_read_orc(f)
got = pd.read_orc(f)

assert_eq(pdf, got)

Expand Down
Loading

0 comments on commit ec43524

Please sign in to comment.