Skip to content

Commit cd160be

Browse files
committed
suggestd edits
1 parent 4506bc5 commit cd160be

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

pandas/tests/apply/test_frame_apply.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -653,9 +653,7 @@ def test_apply_dict(df, dicts):
653653

654654
def test_apply_non_numpy_dtype():
655655
# GH 12244
656-
df = DataFrame(
657-
{"dt": date_range("2015-01-01", periods=3, tz="Europe/Brussels", unit="ns")}
658-
)
656+
df = DataFrame({"dt": date_range("2015-01-01", periods=3, tz="Europe/Brussels")})
659657
result = df.apply(lambda x: x)
660658
tm.assert_frame_equal(result, df)
661659

@@ -1427,7 +1425,7 @@ def test_nuiscance_columns():
14271425
"A": [1, 2, 3],
14281426
"B": [1.0, 2.0, 3.0],
14291427
"C": ["foo", "bar", "baz"],
1430-
"D": date_range("20130101", periods=3, unit="ns"),
1428+
"D": date_range("20130101", periods=3),
14311429
}
14321430
)
14331431

@@ -1437,7 +1435,7 @@ def test_nuiscance_columns():
14371435

14381436
result = df.agg(["min"])
14391437
expected = DataFrame(
1440-
[[1, 1.0, "bar", Timestamp("20130101").as_unit("ns")]],
1438+
[[1, 1.0, "bar", Timestamp("20130101")]],
14411439
index=["min"],
14421440
columns=df.columns,
14431441
)

pandas/tests/indexes/datetimes/test_date_range.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,9 +1845,18 @@ def test_date_range_unit_inference_tick(self):
18451845
assert dti.unit == "ns"
18461846

18471847
def test_date_range_unit_inference_dateoffset_freq(self):
1848-
off = DateOffset(microseconds=2_000_000)
1848+
start = Timestamp("2025-11-25 09:00:00").as_unit("s")
1849+
end = Timestamp("2025-11-25 09:00:02").as_unit("s")
18491850

1850-
start = Timestamp("2025-11-25").as_unit("ms")
1851-
end = Timestamp("2025-11-26").as_unit("s")
1851+
off = DateOffset(microseconds=2_000_000)
18521852
dti = date_range(start, end, freq=off)
18531853
assert dti.unit == "us"
1854+
1855+
off = DateOffset(milliseconds=2)
1856+
dti = date_range(start, end, freq=off)
1857+
assert dti.unit == "ms"
1858+
1859+
end2 = start + Timedelta(microseconds=2).as_unit("us")
1860+
off = DateOffset(nanoseconds=2)
1861+
dti = date_range(start, end2, freq=off)
1862+
assert dti.unit == "ns"

0 commit comments

Comments
 (0)