Closed
Description
This works:
In [9]: pd.Period("2013").asfreq(freq="M", how="S")
Out[9]: Period('2013-01', 'M')
but this does not:
In [8]: pd.Period("2013").asfreq(freq="MS", how="S")
----> 1 pd.Period("2013").asfreq(freq="MS", how="S")
/usr/local/lib/python2.7/dist-packages/pandas/tseries/period.pyc in asfreq(self, freq, how)
196 how = _validate_end_alias(how)
197 base1, mult1 = _gfc(self.freq)
--> 198 base2, mult2 = _gfc(freq)
199
200 if mult2 != 1:
/usr/local/lib/python2.7/dist-packages/pandas/tseries/frequencies.pyc in get_freq_code(freqstr)
99
100 base, stride = _base_and_stride(freqstr)
--> 101 code = _period_str_to_code(base)
102
103 return code, stride
/usr/local/lib/python2.7/dist-packages/pandas/tseries/frequencies.pyc in _period_str_to_code(freqstr)
744 return _period_code_map[freqstr]
745 except:
--> 746 alias = _period_alias_dict[freqstr]
747 return _period_code_map[alias]
748
KeyError: 'L'
it seems to be treating the capital MS
as lower case ms
, meaning millisecond. Observer similar results:
In [11]: pd.Period("2013").asfreq(freq="ms", how="S")
----> 1 pd.Period("2013").asfreq(freq="ms", how="S")
/usr/local/lib/python2.7/dist-packages/pandas/tseries/period.pyc in asfreq(self, freq, how)
196 how = _validate_end_alias(how)
197 base1, mult1 = _gfc(self.freq)
--> 198 base2, mult2 = _gfc(freq)
199
200 if mult2 != 1:
/usr/local/lib/python2.7/dist-packages/pandas/tseries/frequencies.pyc in get_freq_code(freqstr)
99
100 base, stride = _base_and_stride(freqstr)
--> 101 code = _period_str_to_code(base)
102
103 return code, stride
/usr/local/lib/python2.7/dist-packages/pandas/tseries/frequencies.pyc in _period_str_to_code(freqstr)
744 return _period_code_map[freqstr]
745 except:
--> 746 alias = _period_alias_dict[freqstr]
747 return _period_code_map[alias]
748
KeyError: 'L'