diff --git a/python/cudf/cudf/core/column/column.py b/python/cudf/cudf/core/column/column.py index 53dbb9c50cc..0b2b9fda2fd 100644 --- a/python/cudf/cudf/core/column/column.py +++ b/python/cudf/cudf/core/column/column.py @@ -2237,6 +2237,12 @@ def as_column( raise NotImplementedError( "cuDF does not yet support timezone-aware datetimes" ) + elif ( + cudf.get_option("mode.pandas_compatible") + and isinstance(arbitrary, (pd.DatetimeIndex, pd.TimedeltaIndex)) + and arbitrary.freq is not None + ): + raise NotImplementedError("freq is not implemented yet") else: try: data = as_column( diff --git a/python/cudf/cudf/tests/test_index.py b/python/cudf/cudf/tests/test_index.py index 4efd7db4bc5..2da3d3d3ce1 100644 --- a/python/cudf/cudf/tests/test_index.py +++ b/python/cudf/cudf/tests/test_index.py @@ -2670,3 +2670,11 @@ def test_index_mixed_dtype_error(data): pi = pd.Index(data) with pytest.raises(TypeError): cudf.Index(pi) + + +@pytest.mark.parametrize("cls", [pd.DatetimeIndex, pd.TimedeltaIndex]) +def test_index_date_duration_freq_error(cls): + s = cls([1, 2, 3], freq="infer") + with cudf.option_context("mode.pandas_compatible", True): + with pytest.raises(NotImplementedError): + cudf.Index(s)