Skip to content

Commit ee40976

Browse files
update groupby / resample / reshape tests
1 parent cf12f9b commit ee40976

File tree

5 files changed

+7
-11
lines changed

5 files changed

+7
-11
lines changed

pandas/tests/groupby/test_timegrouper.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,7 @@ def test_groupby_max_datetime64(self):
739739
# GH 5869
740740
# datetimelike dtype conversion from int
741741
df = DataFrame({"A": Timestamp("20130101"), "B": np.arange(5)})
742-
# TODO: can we retain second reso in .apply here?
743-
expected = df.groupby("A")["A"].apply(lambda x: x.max()).astype("M8[s]")
742+
expected = df.groupby("A")["A"].apply(lambda x: x.max())
744743
result = df.groupby("A")["A"].max()
745744
tm.assert_series_equal(result, expected)
746745

pandas/tests/resample/test_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def test_resample_empty_sum_string(string_dtype_no_object, min_count):
243243
result = rs.sum(min_count=min_count)
244244

245245
value = "" if min_count == 0 else pd.NA
246-
index = date_range(start="2000-01-01", freq="20s", periods=2, unit="s")
246+
index = date_range(start="2000-01-01", freq="20s", periods=2, unit="us")
247247
expected = Series(value, index=index, dtype=dtype)
248248
tm.assert_series_equal(result, expected)
249249

pandas/tests/reshape/concat/test_append_common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
"float64": [1.1, np.nan, 3.3],
2222
"category": Categorical(["X", "Y", "Z"]),
2323
"object": ["a", "b", "c"],
24-
"datetime64[s]": [
24+
"datetime64[us]": [
2525
pd.Timestamp("2011-01-01"),
2626
pd.Timestamp("2011-01-02"),
2727
pd.Timestamp("2011-01-03"),
2828
],
29-
"datetime64[s, US/Eastern]": [
29+
"datetime64[us, US/Eastern]": [
3030
pd.Timestamp("2011-01-01", tz="US/Eastern"),
3131
pd.Timestamp("2011-01-02", tz="US/Eastern"),
3232
pd.Timestamp("2011-01-03", tz="US/Eastern"),

pandas/tests/reshape/concat/test_datetimes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def test_concat_tz_series_tzlocal(self):
358358

359359
result = concat([Series(x), Series(y)], ignore_index=True)
360360
tm.assert_series_equal(result, Series(x + y))
361-
assert result.dtype == "datetime64[s, tzlocal()]"
361+
assert result.dtype == "datetime64[us, tzlocal()]"
362362

363363
def test_concat_tz_series_with_datetimelike(self):
364364
# see gh-12620: tz and timedelta

pandas/tests/reshape/test_cut.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from datetime import datetime
2-
31
import numpy as np
42
import pytest
53

@@ -452,9 +450,8 @@ def test_datetime_bin(conv):
452450
bins = [conv(v) for v in bin_data]
453451
result = Series(cut(data, bins=bins))
454452

455-
if type(bins[0]) is datetime:
456-
# The bins have microsecond dtype -> so does result
457-
expected = expected.astype("interval[datetime64[us]]")
453+
if type(bins[0]) is np.datetime64:
454+
expected = expected.astype("interval[datetime64[s]]")
458455

459456
expected = expected.astype(CategoricalDtype(ordered=True))
460457
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)