Skip to content

Commit

Permalink
Add tests for NaT when performing dt.to_period (pandas-dev#24921)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-ponomaroff authored and Pingviinituutti committed Feb 28, 2019
1 parent c539848 commit 60fab6e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pandas/tests/series/test_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,12 @@ def test_end_time_timevalues(self, input_vals):
result = s.dt.end_time
expected = s.apply(lambda x: x.end_time)
tm.assert_series_equal(result, expected)

@pytest.mark.parametrize('input_vals', [
('2001'), ('NaT')
])
def test_to_period(self, input_vals):
# GH 21205
expected = Series([input_vals], dtype='Period[D]')
result = Series([input_vals], dtype='datetime64[ns]').dt.to_period('D')
tm.assert_series_equal(result, expected)

0 comments on commit 60fab6e

Please sign in to comment.