Skip to content

Commit 85c82bf

Browse files
authored
Merge branch 'main' into Subtraction-fails-with-matching-index-of-different-name-and-type-pandas-dev#57524
2 parents cf04e0a + 6fa2a4b commit 85c82bf

File tree

14 files changed

+225
-74
lines changed

14 files changed

+225
-74
lines changed

ci/code_checks.sh

-35
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,12 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
173173
pandas.Timestamp.tzinfo\
174174
pandas.Timestamp.value\
175175
pandas.Timestamp.year\
176-
pandas.tseries.offsets.BQuarterBegin.is_anchored\
177176
pandas.tseries.offsets.BQuarterBegin.is_on_offset\
178177
pandas.tseries.offsets.BQuarterBegin.n\
179178
pandas.tseries.offsets.BQuarterBegin.nanos\
180179
pandas.tseries.offsets.BQuarterBegin.normalize\
181180
pandas.tseries.offsets.BQuarterBegin.rule_code\
182181
pandas.tseries.offsets.BQuarterBegin.startingMonth\
183-
pandas.tseries.offsets.BQuarterEnd.is_anchored\
184182
pandas.tseries.offsets.BQuarterEnd.is_on_offset\
185183
pandas.tseries.offsets.BQuarterEnd.n\
186184
pandas.tseries.offsets.BQuarterEnd.nanos\
@@ -278,7 +276,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
278276
pandas.tseries.offsets.Easter.rule_code\
279277
pandas.tseries.offsets.FY5253.get_rule_code_suffix\
280278
pandas.tseries.offsets.FY5253.get_year_end\
281-
pandas.tseries.offsets.FY5253.is_anchored\
282279
pandas.tseries.offsets.FY5253.is_on_offset\
283280
pandas.tseries.offsets.FY5253.n\
284281
pandas.tseries.offsets.FY5253.nanos\
@@ -289,7 +286,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
289286
pandas.tseries.offsets.FY5253.weekday\
290287
pandas.tseries.offsets.FY5253Quarter.get_rule_code_suffix\
291288
pandas.tseries.offsets.FY5253Quarter.get_weeks\
292-
pandas.tseries.offsets.FY5253Quarter.is_anchored\
293289
pandas.tseries.offsets.FY5253Quarter.is_on_offset\
294290
pandas.tseries.offsets.FY5253Quarter.n\
295291
pandas.tseries.offsets.FY5253Quarter.nanos\
@@ -342,14 +338,12 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
342338
pandas.tseries.offsets.Nano.n\
343339
pandas.tseries.offsets.Nano.normalize\
344340
pandas.tseries.offsets.Nano.rule_code\
345-
pandas.tseries.offsets.QuarterBegin.is_anchored\
346341
pandas.tseries.offsets.QuarterBegin.is_on_offset\
347342
pandas.tseries.offsets.QuarterBegin.n\
348343
pandas.tseries.offsets.QuarterBegin.nanos\
349344
pandas.tseries.offsets.QuarterBegin.normalize\
350345
pandas.tseries.offsets.QuarterBegin.rule_code\
351346
pandas.tseries.offsets.QuarterBegin.startingMonth\
352-
pandas.tseries.offsets.QuarterEnd.is_anchored\
353347
pandas.tseries.offsets.QuarterEnd.is_on_offset\
354348
pandas.tseries.offsets.QuarterEnd.n\
355349
pandas.tseries.offsets.QuarterEnd.nanos\
@@ -379,7 +373,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
379373
pandas.tseries.offsets.Tick.n\
380374
pandas.tseries.offsets.Tick.normalize\
381375
pandas.tseries.offsets.Tick.rule_code\
382-
pandas.tseries.offsets.Week.is_anchored\
383376
pandas.tseries.offsets.Week.is_on_offset\
384377
pandas.tseries.offsets.Week.n\
385378
pandas.tseries.offsets.Week.nanos\
@@ -1500,75 +1493,62 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
15001493
pandas.tseries.offsets.BQuarterEnd.name\
15011494
pandas.tseries.offsets.BYearBegin.copy\
15021495
pandas.tseries.offsets.BYearBegin.freqstr\
1503-
pandas.tseries.offsets.BYearBegin.is_anchored\
15041496
pandas.tseries.offsets.BYearBegin.kwds\
15051497
pandas.tseries.offsets.BYearBegin.name\
15061498
pandas.tseries.offsets.BYearEnd.copy\
15071499
pandas.tseries.offsets.BYearEnd.freqstr\
1508-
pandas.tseries.offsets.BYearEnd.is_anchored\
15091500
pandas.tseries.offsets.BYearEnd.kwds\
15101501
pandas.tseries.offsets.BYearEnd.name\
15111502
pandas.tseries.offsets.BusinessDay\
15121503
pandas.tseries.offsets.BusinessDay.copy\
15131504
pandas.tseries.offsets.BusinessDay.freqstr\
1514-
pandas.tseries.offsets.BusinessDay.is_anchored\
15151505
pandas.tseries.offsets.BusinessDay.kwds\
15161506
pandas.tseries.offsets.BusinessDay.name\
15171507
pandas.tseries.offsets.BusinessHour\
15181508
pandas.tseries.offsets.BusinessHour.copy\
15191509
pandas.tseries.offsets.BusinessHour.freqstr\
1520-
pandas.tseries.offsets.BusinessHour.is_anchored\
15211510
pandas.tseries.offsets.BusinessHour.kwds\
15221511
pandas.tseries.offsets.BusinessHour.name\
15231512
pandas.tseries.offsets.BusinessMonthBegin.copy\
15241513
pandas.tseries.offsets.BusinessMonthBegin.freqstr\
1525-
pandas.tseries.offsets.BusinessMonthBegin.is_anchored\
15261514
pandas.tseries.offsets.BusinessMonthBegin.kwds\
15271515
pandas.tseries.offsets.BusinessMonthBegin.name\
15281516
pandas.tseries.offsets.BusinessMonthEnd.copy\
15291517
pandas.tseries.offsets.BusinessMonthEnd.freqstr\
1530-
pandas.tseries.offsets.BusinessMonthEnd.is_anchored\
15311518
pandas.tseries.offsets.BusinessMonthEnd.kwds\
15321519
pandas.tseries.offsets.BusinessMonthEnd.name\
15331520
pandas.tseries.offsets.CDay\
15341521
pandas.tseries.offsets.CustomBusinessDay\
15351522
pandas.tseries.offsets.CustomBusinessDay.copy\
15361523
pandas.tseries.offsets.CustomBusinessDay.freqstr\
1537-
pandas.tseries.offsets.CustomBusinessDay.is_anchored\
15381524
pandas.tseries.offsets.CustomBusinessDay.kwds\
15391525
pandas.tseries.offsets.CustomBusinessDay.name\
15401526
pandas.tseries.offsets.CustomBusinessHour\
15411527
pandas.tseries.offsets.CustomBusinessHour.copy\
15421528
pandas.tseries.offsets.CustomBusinessHour.freqstr\
1543-
pandas.tseries.offsets.CustomBusinessHour.is_anchored\
15441529
pandas.tseries.offsets.CustomBusinessHour.kwds\
15451530
pandas.tseries.offsets.CustomBusinessHour.name\
15461531
pandas.tseries.offsets.CustomBusinessMonthBegin.copy\
15471532
pandas.tseries.offsets.CustomBusinessMonthBegin.freqstr\
1548-
pandas.tseries.offsets.CustomBusinessMonthBegin.is_anchored\
15491533
pandas.tseries.offsets.CustomBusinessMonthBegin.is_on_offset\
15501534
pandas.tseries.offsets.CustomBusinessMonthBegin.kwds\
15511535
pandas.tseries.offsets.CustomBusinessMonthBegin.name\
15521536
pandas.tseries.offsets.CustomBusinessMonthEnd.copy\
15531537
pandas.tseries.offsets.CustomBusinessMonthEnd.freqstr\
1554-
pandas.tseries.offsets.CustomBusinessMonthEnd.is_anchored\
15551538
pandas.tseries.offsets.CustomBusinessMonthEnd.is_on_offset\
15561539
pandas.tseries.offsets.CustomBusinessMonthEnd.kwds\
15571540
pandas.tseries.offsets.CustomBusinessMonthEnd.name\
15581541
pandas.tseries.offsets.DateOffset.copy\
15591542
pandas.tseries.offsets.DateOffset.freqstr\
1560-
pandas.tseries.offsets.DateOffset.is_anchored\
15611543
pandas.tseries.offsets.DateOffset.kwds\
15621544
pandas.tseries.offsets.DateOffset.name\
15631545
pandas.tseries.offsets.Day.copy\
15641546
pandas.tseries.offsets.Day.freqstr\
1565-
pandas.tseries.offsets.Day.is_anchored\
15661547
pandas.tseries.offsets.Day.kwds\
15671548
pandas.tseries.offsets.Day.name\
15681549
pandas.tseries.offsets.Day.nanos\
15691550
pandas.tseries.offsets.Easter.copy\
15701551
pandas.tseries.offsets.Easter.freqstr\
1571-
pandas.tseries.offsets.Easter.is_anchored\
15721552
pandas.tseries.offsets.Easter.kwds\
15731553
pandas.tseries.offsets.Easter.name\
15741554
pandas.tseries.offsets.FY5253.copy\
@@ -1581,47 +1561,39 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
15811561
pandas.tseries.offsets.FY5253Quarter.name\
15821562
pandas.tseries.offsets.Hour.copy\
15831563
pandas.tseries.offsets.Hour.freqstr\
1584-
pandas.tseries.offsets.Hour.is_anchored\
15851564
pandas.tseries.offsets.Hour.kwds\
15861565
pandas.tseries.offsets.Hour.name\
15871566
pandas.tseries.offsets.Hour.nanos\
15881567
pandas.tseries.offsets.LastWeekOfMonth\
15891568
pandas.tseries.offsets.LastWeekOfMonth.copy\
15901569
pandas.tseries.offsets.LastWeekOfMonth.freqstr\
1591-
pandas.tseries.offsets.LastWeekOfMonth.is_anchored\
15921570
pandas.tseries.offsets.LastWeekOfMonth.kwds\
15931571
pandas.tseries.offsets.LastWeekOfMonth.name\
15941572
pandas.tseries.offsets.Micro.copy\
15951573
pandas.tseries.offsets.Micro.freqstr\
1596-
pandas.tseries.offsets.Micro.is_anchored\
15971574
pandas.tseries.offsets.Micro.kwds\
15981575
pandas.tseries.offsets.Micro.name\
15991576
pandas.tseries.offsets.Micro.nanos\
16001577
pandas.tseries.offsets.Milli.copy\
16011578
pandas.tseries.offsets.Milli.freqstr\
1602-
pandas.tseries.offsets.Milli.is_anchored\
16031579
pandas.tseries.offsets.Milli.kwds\
16041580
pandas.tseries.offsets.Milli.name\
16051581
pandas.tseries.offsets.Milli.nanos\
16061582
pandas.tseries.offsets.Minute.copy\
16071583
pandas.tseries.offsets.Minute.freqstr\
1608-
pandas.tseries.offsets.Minute.is_anchored\
16091584
pandas.tseries.offsets.Minute.kwds\
16101585
pandas.tseries.offsets.Minute.name\
16111586
pandas.tseries.offsets.Minute.nanos\
16121587
pandas.tseries.offsets.MonthBegin.copy\
16131588
pandas.tseries.offsets.MonthBegin.freqstr\
1614-
pandas.tseries.offsets.MonthBegin.is_anchored\
16151589
pandas.tseries.offsets.MonthBegin.kwds\
16161590
pandas.tseries.offsets.MonthBegin.name\
16171591
pandas.tseries.offsets.MonthEnd.copy\
16181592
pandas.tseries.offsets.MonthEnd.freqstr\
1619-
pandas.tseries.offsets.MonthEnd.is_anchored\
16201593
pandas.tseries.offsets.MonthEnd.kwds\
16211594
pandas.tseries.offsets.MonthEnd.name\
16221595
pandas.tseries.offsets.Nano.copy\
16231596
pandas.tseries.offsets.Nano.freqstr\
1624-
pandas.tseries.offsets.Nano.is_anchored\
16251597
pandas.tseries.offsets.Nano.kwds\
16261598
pandas.tseries.offsets.Nano.name\
16271599
pandas.tseries.offsets.Nano.nanos\
@@ -1635,25 +1607,21 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
16351607
pandas.tseries.offsets.QuarterEnd.name\
16361608
pandas.tseries.offsets.Second.copy\
16371609
pandas.tseries.offsets.Second.freqstr\
1638-
pandas.tseries.offsets.Second.is_anchored\
16391610
pandas.tseries.offsets.Second.kwds\
16401611
pandas.tseries.offsets.Second.name\
16411612
pandas.tseries.offsets.Second.nanos\
16421613
pandas.tseries.offsets.SemiMonthBegin\
16431614
pandas.tseries.offsets.SemiMonthBegin.copy\
16441615
pandas.tseries.offsets.SemiMonthBegin.freqstr\
1645-
pandas.tseries.offsets.SemiMonthBegin.is_anchored\
16461616
pandas.tseries.offsets.SemiMonthBegin.kwds\
16471617
pandas.tseries.offsets.SemiMonthBegin.name\
16481618
pandas.tseries.offsets.SemiMonthEnd\
16491619
pandas.tseries.offsets.SemiMonthEnd.copy\
16501620
pandas.tseries.offsets.SemiMonthEnd.freqstr\
1651-
pandas.tseries.offsets.SemiMonthEnd.is_anchored\
16521621
pandas.tseries.offsets.SemiMonthEnd.kwds\
16531622
pandas.tseries.offsets.SemiMonthEnd.name\
16541623
pandas.tseries.offsets.Tick.copy\
16551624
pandas.tseries.offsets.Tick.freqstr\
1656-
pandas.tseries.offsets.Tick.is_anchored\
16571625
pandas.tseries.offsets.Tick.kwds\
16581626
pandas.tseries.offsets.Tick.name\
16591627
pandas.tseries.offsets.Tick.nanos\
@@ -1664,17 +1632,14 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
16641632
pandas.tseries.offsets.WeekOfMonth\
16651633
pandas.tseries.offsets.WeekOfMonth.copy\
16661634
pandas.tseries.offsets.WeekOfMonth.freqstr\
1667-
pandas.tseries.offsets.WeekOfMonth.is_anchored\
16681635
pandas.tseries.offsets.WeekOfMonth.kwds\
16691636
pandas.tseries.offsets.WeekOfMonth.name\
16701637
pandas.tseries.offsets.YearBegin.copy\
16711638
pandas.tseries.offsets.YearBegin.freqstr\
1672-
pandas.tseries.offsets.YearBegin.is_anchored\
16731639
pandas.tseries.offsets.YearBegin.kwds\
16741640
pandas.tseries.offsets.YearBegin.name\
16751641
pandas.tseries.offsets.YearEnd.copy\
16761642
pandas.tseries.offsets.YearEnd.freqstr\
1677-
pandas.tseries.offsets.YearEnd.is_anchored\
16781643
pandas.tseries.offsets.YearEnd.kwds\
16791644
pandas.tseries.offsets.YearEnd.name\
16801645
pandas.util.hash_array\

doc/source/development/maintaining.rst

-28
Original file line numberDiff line numberDiff line change
@@ -326,34 +326,6 @@ a milestone before tagging, you can request the bot to backport it with:
326326
@Meeseeksdev backport <branch>
327327
328328
329-
.. _maintaining.asv-machine:
330-
331-
Benchmark machine
332-
-----------------
333-
334-
The team currently owns dedicated hardware for hosting a website for pandas' ASV performance benchmark. The results
335-
are published to https://asv-runner.github.io/asv-collection/pandas/
336-
337-
Configuration
338-
`````````````
339-
340-
The machine can be configured with the `Ansible <http://docs.ansible.com/ansible/latest/index.html>`_ playbook in https://github.com/tomaugspurger/asv-runner.
341-
342-
Publishing
343-
``````````
344-
345-
The results are published to another GitHub repository, https://github.com/tomaugspurger/asv-collection.
346-
Finally, we have a cron job on our docs server to pull from https://github.com/tomaugspurger/asv-collection, to serve them from ``/speed``.
347-
Ask Tom or Joris for access to the webserver.
348-
349-
Debugging
350-
`````````
351-
352-
The benchmarks are scheduled by Airflow. It has a dashboard for viewing and debugging the results. You'll need to setup an SSH tunnel to view them
353-
354-
ssh -L 8080:localhost:8080 [email protected]
355-
356-
357329
.. _maintaining.release:
358330

359331
Release process

doc/source/whatsnew/v3.0.0.rst

+5-2
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ Removal of prior version deprecations/changes
244244

245245
Performance improvements
246246
~~~~~~~~~~~~~~~~~~~~~~~~
247+
- :meth:`Series.str.extract` returns a :class:`RangeIndex` columns instead of an :class:`Index` column when possible (:issue:`57542`)
247248
- Performance improvement in :class:`DataFrame` when ``data`` is a ``dict`` and ``columns`` is specified (:issue:`24368`)
248249
- Performance improvement in :meth:`DataFrame.join` for sorted but non-unique indexes (:issue:`56941`)
249250
- Performance improvement in :meth:`DataFrame.join` when left and/or right are non-unique and ``how`` is ``"left"``, ``"right"``, or ``"inner"`` (:issue:`56817`)
@@ -252,11 +253,11 @@ Performance improvements
252253
- Performance improvement in :meth:`Index.join` by propagating cached attributes in cases where the result matches one of the inputs (:issue:`57023`)
253254
- Performance improvement in :meth:`Index.take` when ``indices`` is a full range indexer from zero to length of index (:issue:`56806`)
254255
- Performance improvement in :meth:`MultiIndex.equals` for equal length indexes (:issue:`56990`)
256+
- Performance improvement in :meth:`RangeIndex.__getitem__` with a boolean mask returning a :class:`RangeIndex` instead of a :class:`Index` when possible. (:issue:`57588`)
255257
- Performance improvement in :meth:`RangeIndex.append` when appending the same index (:issue:`57252`)
256258
- Performance improvement in :meth:`RangeIndex.take` returning a :class:`RangeIndex` instead of a :class:`Index` when possible. (:issue:`57445`)
257-
- Performance improvement in indexing operations for string dtypes (:issue:`56997`)
258-
- :meth:`Series.str.extract` returns a :class:`RangeIndex` columns instead of an :class:`Index` column when possible (:issue:`?``)
259259
- Performance improvement in ``DataFrameGroupBy.__len__`` and ``SeriesGroupBy.__len__`` (:issue:`57595`)
260+
- Performance improvement in indexing operations for string dtypes (:issue:`56997`)
260261

261262
.. ---------------------------------------------------------------------------
262263
.. _whatsnew_300.bug_fixes:
@@ -265,6 +266,7 @@ Bug fixes
265266
~~~~~~~~~
266267
- Fixed bug in :meth:`DataFrame.join` inconsistently setting result index name (:issue:`55815`)
267268
- Fixed bug in :meth:`DataFrame.to_string` that raised ``StopIteration`` with nested DataFrames. (:issue:`16098`)
269+
- Fixed bug in :meth:`DataFrame.update` bool dtype being converted to object (:issue:`55509`)
268270
- Fixed bug in :meth:`Series.diff` allowing non-integer values for the ``periods`` argument. (:issue:`56607`)
269271
- Fixed bug in :meth:`take` allowing ``indexer`` argument to be None (:issue:`57524`)
270272

@@ -325,6 +327,7 @@ MultiIndex
325327

326328
I/O
327329
^^^
330+
- Bug in :meth:`DataFrame.to_excel` when writing empty :class:`DataFrame` with :class:`MultiIndex` on both axes (:issue:`57696`)
328331
-
329332
-
330333

pandas/_libs/src/vendored/ujson/python/objToJSON.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ typedef struct __NpyArrContext {
7474
npy_intp ndim;
7575
npy_intp index[NPY_MAXDIMS];
7676
int type_num;
77-
PyArray_GetItemFunc *getitem;
7877

7978
char **rowLabels;
8079
char **columnLabels;
@@ -405,7 +404,6 @@ static void NpyArr_iterBegin(JSOBJ _obj, JSONTypeContext *tc) {
405404
}
406405

407406
npyarr->array = (PyObject *)obj;
408-
npyarr->getitem = (PyArray_GetItemFunc *)PyArray_DESCR(obj)->f->getitem;
409407
npyarr->dataptr = PyArray_DATA(obj);
410408
npyarr->ndim = PyArray_NDIM(obj) - 1;
411409
npyarr->curdim = 0;
@@ -492,7 +490,7 @@ static int NpyArr_iterNextItem(JSOBJ obj, JSONTypeContext *tc) {
492490
((PyObjectEncoder *)tc->encoder)->npyValue = npyarr->dataptr;
493491
((PyObjectEncoder *)tc->encoder)->npyCtxtPassthru = npyarr;
494492
} else {
495-
GET_TC(tc)->itemValue = npyarr->getitem(npyarr->dataptr, npyarr->array);
493+
GET_TC(tc)->itemValue = PyArray_GETITEM(arrayobj, npyarr->dataptr);
496494
}
497495

498496
npyarr->dataptr += npyarr->stride;

pandas/core/frame.py

+19-4
Original file line numberDiff line numberDiff line change
@@ -8706,6 +8706,10 @@ def update(
87068706
dict.update : Similar method for dictionaries.
87078707
DataFrame.merge : For column(s)-on-column(s) operations.
87088708
8709+
Notes
8710+
-----
8711+
1. Duplicate indices on `other` are not supported and raises `ValueError`.
8712+
87098713
Examples
87108714
--------
87118715
>>> df = pd.DataFrame({"A": [1, 2, 3], "B": [400, 500, 600]})
@@ -8778,11 +8782,22 @@ def update(
87788782
if not isinstance(other, DataFrame):
87798783
other = DataFrame(other)
87808784

8781-
other = other.reindex(self.index)
8785+
if other.index.has_duplicates:
8786+
raise ValueError("Update not allowed with duplicate indexes on other.")
8787+
8788+
index_intersection = other.index.intersection(self.index)
8789+
if index_intersection.empty:
8790+
raise ValueError(
8791+
"Update not allowed when the index on `other` has no intersection "
8792+
"with this dataframe."
8793+
)
8794+
8795+
other = other.reindex(index_intersection)
8796+
this_data = self.loc[index_intersection]
87828797

87838798
for col in self.columns.intersection(other.columns):
8784-
this = self[col]._values
8785-
that = other[col]._values
8799+
this = this_data[col]
8800+
that = other[col]
87868801

87878802
if filter_func is not None:
87888803
mask = ~filter_func(this) | isna(that)
@@ -8802,7 +8817,7 @@ def update(
88028817
if mask.all():
88038818
continue
88048819

8805-
self.loc[:, col] = self[col].where(mask, that)
8820+
self.loc[index_intersection, col] = this.where(mask, that)
88068821

88078822
# ----------------------------------------------------------------------
88088823
# Data reshaping

0 commit comments

Comments
 (0)