Skip to content

BUG: remove millisecond field that raises valueerror #12019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/source/whatsnew/v0.18.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -503,3 +503,6 @@ Bug Fixes
- Bug in ``.to_csv`` ignoring formatting parameters ``decimal``, ``na_rep``, ``float_format`` for float indexes (:issue:`11553`)

- Bug in ``DataFrame`` when masking an empty ``DataFrame`` (:issue:`11859`)

- Removed ``millisecond`` property of ``DatetimeIndex``. This would always raise
a ``ValueError`` (:issue:`12019`).
6 changes: 6 additions & 0 deletions pandas/tests/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -4028,6 +4028,12 @@ def test_fillna_period(self):
with tm.assertRaisesRegexp(ValueError, 'Input has different freq=D from PeriodIndex\\(freq=H\\)'):
idx.fillna(pd.Period('2011-01-01', freq='D'))

def test_no_millisecond_field(self):
with self.assertRaises(AttributeError):
DatetimeIndex.millisecond

with self.assertRaises(AttributeError):
DatetimeIndex([]).millisecond

class TestTimedeltaIndex(DatetimeLike, tm.TestCase):
_holder = TimedeltaIndex
Expand Down
1 change: 0 additions & 1 deletion pandas/tseries/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -1469,7 +1469,6 @@ def _set_freq(self, value):
hour = _field_accessor('hour', 'h', "The hours of the datetime")
minute = _field_accessor('minute', 'm', "The minutes of the datetime")
second = _field_accessor('second', 's', "The seconds of the datetime")
millisecond = _field_accessor('millisecond', 'ms', "The milliseconds of the datetime")
microsecond = _field_accessor('microsecond', 'us', "The microseconds of the datetime")
nanosecond = _field_accessor('nanosecond', 'ns', "The nanoseconds of the datetime")
weekofyear = _field_accessor('weekofyear', 'woy', "The week ordinal of the year")
Expand Down