|
56 | 56 | from pandas._libs import (lib, index as libindex, tslib as libts,
|
57 | 57 | join as libjoin, Timestamp)
|
58 | 58 | from pandas._libs.tslibs import (timezones, conversion, fields, parsing,
|
59 |
| - resolution as libresolution) |
| 59 | + resolution as libresolution, ccalendar) |
60 | 60 |
|
61 | 61 | # -------- some conversion wrapper functions
|
62 | 62 |
|
@@ -95,10 +95,8 @@ def f(self):
|
95 | 95 | result = self._maybe_mask_results(result, convert='float64')
|
96 | 96 |
|
97 | 97 | if field in ['weekday_name', 'day_name']:
|
98 |
| - cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', |
99 |
| - 'Friday', 'Saturday', 'Sunday'] |
100 |
| - index = CategoricalIndex(result, ordered=True, categories=cats, |
101 |
| - name=self.name) |
| 98 | + index = CategoricalIndex(result, ordered=True, name=self.name, |
| 99 | + categories=ccalendar.DAYS_FULL) |
102 | 100 | return index
|
103 | 101 | index = Index(result, name=self.name)
|
104 | 102 | return index
|
@@ -2539,7 +2537,8 @@ def day_name(self, locale=None):
|
2539 | 2537 | result = fields.get_date_name_field(values, 'day_name',
|
2540 | 2538 | locale=locale)
|
2541 | 2539 | result = self._maybe_mask_results(result)
|
2542 |
| - return Index(result, name=self.name) |
| 2540 | + return CategoricalIndex(result, ordered=True, name=self.name, |
| 2541 | + categories=ccalendar.DAYS_FULL) |
2543 | 2542 |
|
2544 | 2543 |
|
2545 | 2544 | DatetimeIndex._add_comparison_methods()
|
|
0 commit comments