Skip to content

Commit ba28c3c

Browse files
committed
API: Use lowest possible datetime64 resolution in PeriodIndex.to_timestamp
1 parent 5164f2f commit ba28c3c

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

pandas/tests/indexes/period/test_period.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -240,19 +240,7 @@ def test_to_timestamp_monthly_resolution():
240240

241241

242242
def test_to_timestamp_yearly_resolution():
243-
idx = PeriodIndex(["2011", "2012"], freq="A")
244-
ts = idx.to_timestamp()
245-
assert ts.dtype == np.dtype("datetime64[ns]")
246-
247-
248-
def test_to_timestamp_large_month_no_out_of_bounds():
249-
idx = PeriodIndex(["May 3000"], freq="M")
250-
ts = idx.to_timestamp()
251-
assert ts.dtype == np.dtype("datetime64[ns]")
252-
253-
254-
def test_to_timestamp_large_year_no_out_of_bounds():
255-
idx = PeriodIndex(["3000"], freq="Y")
243+
idx = PeriodIndex(["2011", "2012"], freq="Y")
256244
ts = idx.to_timestamp()
257245
assert ts.dtype == np.dtype("datetime64[ns]")
258246

@@ -265,7 +253,7 @@ def test_to_timestamp_daily_resolution():
265253

266254
def test_to_timestamp_nanosecond_resolution():
267255
idx = PeriodIndex(
268-
["2011-01-01 00:00:00.000000001", "2011-01-01 00:00:00.000000002"], freq="N"
256+
["2011-01-01 00:00:00.000000001", "2011-01-01 00:00:00.000000002"], freq="ns"
269257
)
270258
ts = idx.to_timestamp()
271259
assert ts.dtype == np.dtype("datetime64[ns]")

0 commit comments

Comments
 (0)