Skip to content

Commit 1f7d552

Browse files
Merge remote-tracking branch 'upstream/main' into string-dtype-tests-all-xfail
2 parents d75722c + c8bdce9 commit 1f7d552

File tree

6 files changed

+44
-4
lines changed

6 files changed

+44
-4
lines changed

ci/code_checks.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
223223
-i "pandas.Timestamp.fromordinal SA01" \
224224
-i "pandas.Timestamp.fromtimestamp PR01,SA01" \
225225
-i "pandas.Timestamp.hour GL08" \
226-
-i "pandas.Timestamp.isoweekday SA01" \
227226
-i "pandas.Timestamp.max PR02" \
228227
-i "pandas.Timestamp.microsecond GL08" \
229228
-i "pandas.Timestamp.min PR02" \
@@ -328,7 +327,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
328327
-i "pandas.core.groupby.DataFrameGroupBy.hist RT03" \
329328
-i "pandas.core.groupby.DataFrameGroupBy.indices SA01" \
330329
-i "pandas.core.groupby.DataFrameGroupBy.max SA01" \
331-
-i "pandas.core.groupby.DataFrameGroupBy.median SA01" \
332330
-i "pandas.core.groupby.DataFrameGroupBy.min SA01" \
333331
-i "pandas.core.groupby.DataFrameGroupBy.nth PR02" \
334332
-i "pandas.core.groupby.DataFrameGroupBy.nunique SA01" \
@@ -347,7 +345,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
347345
-i "pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing SA01" \
348346
-i "pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing SA01" \
349347
-i "pandas.core.groupby.SeriesGroupBy.max SA01" \
350-
-i "pandas.core.groupby.SeriesGroupBy.median SA01" \
351348
-i "pandas.core.groupby.SeriesGroupBy.min SA01" \
352349
-i "pandas.core.groupby.SeriesGroupBy.nth PR02" \
353350
-i "pandas.core.groupby.SeriesGroupBy.ohlc SA01" \
@@ -362,7 +359,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
362359
-i "pandas.core.resample.Resampler.indices SA01" \
363360
-i "pandas.core.resample.Resampler.max PR01,RT03,SA01" \
364361
-i "pandas.core.resample.Resampler.mean SA01" \
365-
-i "pandas.core.resample.Resampler.median SA01" \
366362
-i "pandas.core.resample.Resampler.min PR01,RT03,SA01" \
367363
-i "pandas.core.resample.Resampler.ohlc SA01" \
368364
-i "pandas.core.resample.Resampler.prod SA01" \

pandas/_libs/tslibs/nattype.pyx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,13 @@ class NaTType(_NaT):
441441
442442
Monday == 1 ... Sunday == 7.
443443
444+
See Also
445+
--------
446+
Timestamp.weekday : Return the day of the week with Monday=0, Sunday=6.
447+
Timestamp.isocalendar : Return a tuple containing ISO year, week number
448+
and weekday.
449+
datetime.date.isoweekday : Equivalent method in datetime module.
450+
444451
Examples
445452
--------
446453
>>> ts = pd.Timestamp('2023-01-01 10:00:00')

pandas/_libs/tslibs/timestamps.pyx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2775,6 +2775,13 @@ default 'raise'
27752775
27762776
Monday == 1 ... Sunday == 7.
27772777
2778+
See Also
2779+
--------
2780+
Timestamp.weekday : Return the day of the week with Monday=0, Sunday=6.
2781+
Timestamp.isocalendar : Return a tuple containing ISO year, week number
2782+
and weekday.
2783+
datetime.date.isoweekday : Equivalent method in datetime module.
2784+
27782785
Examples
27792786
--------
27802787
>>> ts = pd.Timestamp('2023-01-01 10:00:00')

pandas/core/groupby/groupby.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2347,6 +2347,12 @@ def median(self, numeric_only: bool = False) -> NDFrameT:
23472347
Series or DataFrame
23482348
Median of values within each group.
23492349
2350+
See Also
2351+
--------
2352+
Series.groupby : Apply a function groupby to a Series.
2353+
DataFrame.groupby : Apply a function groupby to each row or column of a
2354+
DataFrame.
2355+
23502356
Examples
23512357
--------
23522358
For SeriesGroupBy:

pandas/tests/arithmetic/test_datetime64.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,22 @@ def test_dt64_compare_datetime_scalar(self, datetimelike, op, expected):
389389
expected = Series(expected, name="A")
390390
tm.assert_series_equal(result, expected)
391391

392+
def test_ts_series_numpy_maximum(self):
393+
# GH#50864, test numpy.maximum does not fail
394+
# given a TimeStamp and Series(with dtype datetime64) comparison
395+
ts = Timestamp("2024-07-01")
396+
ts_series = Series(
397+
["2024-06-01", "2024-07-01", "2024-08-01"],
398+
dtype="datetime64[us]",
399+
)
400+
401+
expected = Series(
402+
["2024-07-01", "2024-07-01", "2024-08-01"],
403+
dtype="datetime64[us]",
404+
)
405+
406+
tm.assert_series_equal(expected, np.maximum(ts, ts_series))
407+
392408

393409
class TestDatetimeIndexComparisons:
394410
# TODO: moved from tests.indexes.test_base; parametrize and de-duplicate

pandas/tests/indexing/test_loc.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3265,3 +3265,11 @@ def test_loc_nonunique_masked_index(self):
32653265
index=Index(np.array(ids).repeat(1000), dtype="Int64"),
32663266
)
32673267
tm.assert_frame_equal(result, expected)
3268+
3269+
def test_loc_index_alignment_for_series(self):
3270+
# GH #56024
3271+
df = DataFrame({"a": [1, 2], "b": [3, 4]})
3272+
other = Series([200, 999], index=[1, 0])
3273+
df.loc[:, "a"] = other
3274+
expected = DataFrame({"a": [999, 200], "b": [3, 4]})
3275+
tm.assert_frame_equal(expected, df)

0 commit comments

Comments
 (0)