Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pandas/tests/indexes/datetimes/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
to_datetime,
)
import pandas._testing as tm
from pandas._testing.asserters import assert_equal
from pandas.core.arrays import (
DatetimeArray,
period_array,
Expand Down Expand Up @@ -84,6 +85,17 @@ def test_categorical_preserves_tz(self):
result = DatetimeIndex(obj)
tm.assert_index_equal(result, dti)

def test_categorical_preserves_freq(self):
# GH33830 freq retention in categorical
dti = date_range("2016-01-01", periods=5)

expected = dti.freq

cat = pd.Categorical(dti)
result = cat.categories.freq

assert_equal(expected, result)

def test_dti_with_period_data_raises(self):
# GH#23675
data = pd.PeriodIndex(["2016Q1", "2016Q2"], freq="Q")
Expand Down