Skip to content

Commit

Permalink
Add tests for NaT when performing dt.to_period (#24921)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-ponomaroff authored and jreback committed Jan 26, 2019
1 parent c1cad5d commit dd7afa0
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 dd7afa0

Please sign in to comment.