diff --git a/RELEASE.rst b/RELEASE.rst index 5133889c4f9fc..ad3beb79e68d2 100644 --- a/RELEASE.rst +++ b/RELEASE.rst @@ -52,6 +52,7 @@ pandas 0.9.0 - The internal HDF5 data arrangement for DataFrames has been transposed. Legacy files will still be readable by HDFStore (#1834, #1824) - Legacy cruft removed: pandas.stats.misc.quantileTS + - Use ISO8601 format for Period repr: monthly, daily, and on down (#1776) **Bug fixes** diff --git a/pandas/src/plib.pyx b/pandas/src/plib.pyx index 65a64113039dd..a6fe1b034bb5f 100644 --- a/pandas/src/plib.pyx +++ b/pandas/src/plib.pyx @@ -230,7 +230,7 @@ def period_format(int64_t value, int freq, object fmt=None): elif freq_group == 2000: # FR_QTR fmt = b'%FQ%q' elif freq_group == 3000: # FR_MTH - fmt = b'%b-%Y' + fmt = b'%Y-%m' elif freq_group == 4000: # WK left = period_asfreq(value, freq, 6000, 0) right = period_asfreq(value, freq, 6000, 1) @@ -238,13 +238,13 @@ def period_format(int64_t value, int freq, object fmt=None): period_format(right, 6000)) elif (freq_group == 5000 # BUS or freq_group == 6000): # DAY - fmt = b'%d-%b-%Y' + fmt = b'%Y-%m-%d' elif freq_group == 7000: # HR - fmt = b'%d-%b-%Y %H:00' + fmt = b'%Y-%m-%d %H:00' elif freq_group == 8000: # MIN - fmt = b'%d-%b-%Y %H:%M' + fmt = b'%Y-%m-%d %H:%M' elif freq_group == 9000: # SEC - fmt = b'%d-%b-%Y %H:%M:%S' + fmt = b'%Y-%m-%d %H:%M:%S' else: raise ValueError('Unknown freq: %d' % freq) diff --git a/pandas/tseries/tests/test_period.py b/pandas/tseries/tests/test_period.py index ebea4cdb958bd..07dfbfc77dccb 100644 --- a/pandas/tseries/tests/test_period.py +++ b/pandas/tseries/tests/test_period.py @@ -192,7 +192,10 @@ def test_freq_str(self): def test_repr(self): p = Period('Jan-2000') - self.assert_('Jan-2000' in repr(p)) + self.assert_('2000-01' in repr(p)) + + p = Period('2000-12-15') + self.assert_('2000-12-15' in repr(p)) def test_strftime(self): p = Period('2000-1-1 12:34:12', freq='S')