|
13 | 13 | from pandas.core.index import MultiIndex
|
14 | 14 | from pandas.core.series import Series, remove_na
|
15 | 15 | from pandas.tseries.index import DatetimeIndex
|
16 |
| -from pandas.tseries.period import PeriodIndex |
| 16 | +from pandas.tseries.period import PeriodIndex, Period |
17 | 17 | from pandas.tseries.frequencies import get_period_alias, get_base_alias
|
18 | 18 | from pandas.tseries.offsets import DateOffset
|
19 | 19 |
|
@@ -1027,7 +1027,21 @@ def _is_dynamic_freq(self, freq):
|
1027 | 1027 | else:
|
1028 | 1028 | freq = get_base_alias(freq)
|
1029 | 1029 | freq = get_period_alias(freq)
|
1030 |
| - return freq is not None |
| 1030 | + return freq is not None and self._no_base(freq) |
| 1031 | + |
| 1032 | + def _no_base(self, freq): |
| 1033 | + # hack this for 0.10.1, creating more technical debt...sigh |
| 1034 | + from pandas.core.frame import DataFrame |
| 1035 | + if (isinstance(self.data, (Series, DataFrame)) |
| 1036 | + and isinstance(self.data.index, DatetimeIndex)): |
| 1037 | + import pandas.tseries.frequencies as freqmod |
| 1038 | + base = freqmod.get_freq(freq) |
| 1039 | + x = self.data.index |
| 1040 | + if (base <= freqmod.FreqGroup.FR_DAY): |
| 1041 | + return x[:1].is_normalized |
| 1042 | + |
| 1043 | + return Period(x[0], freq).to_timestamp() == x[0] |
| 1044 | + return True |
1031 | 1045 |
|
1032 | 1046 | def _use_dynamic_x(self):
|
1033 | 1047 | freq = self._index_freq()
|
|
0 commit comments