Skip to content

Commit 554c771

Browse files
committed
Make month_name field in DatetimeIndex categorical
1 parent c24da71 commit 554c771

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/core/indexes/datetimes.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -2506,7 +2506,9 @@ def month_name(self, locale=None):
25062506
result = fields.get_date_name_field(values, 'month_name',
25072507
locale=locale)
25082508
result = self._maybe_mask_results(result)
2509-
return Index(result, name=self.name)
2509+
return CategoricalIndex(result, ordered=True,
2510+
categories=ccalendar.MONTHS_FULL[1:],
2511+
name=self.name)
25102512

25112513
def day_name(self, locale=None):
25122514
"""

0 commit comments

Comments
 (0)