Skip to content

Commit 1371a24

Browse files
authored
Merge branch 'main' into bugfix-spss-kwargs
2 parents 2e8a88d + 7281475 commit 1371a24

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+334
-159
lines changed

asv_bench/benchmarks/algos/isin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ def setup(self, dtype):
6161
self.series = Series(
6262
Index([f"i-{i}" for i in range(N)], dtype=object), dtype=dtype
6363
)
64-
except ImportError:
65-
raise NotImplementedError
64+
except ImportError as err:
65+
raise NotImplementedError from err
6666
self.values = list(self.series[:2])
6767

6868
else:

asv_bench/benchmarks/array.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ class ArrowStringArray:
7676
def setup(self, multiple_chunks):
7777
try:
7878
import pyarrow as pa
79-
except ImportError:
80-
raise NotImplementedError
79+
except ImportError as err:
80+
raise NotImplementedError from err
8181
strings = np.array([str(i) for i in range(10_000)], dtype=object)
8282
if multiple_chunks:
8383
chunks = [strings[i : i + 100] for i in range(0, len(strings), 100)]

asv_bench/benchmarks/multiindex_object.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,20 @@ def time_categorical_level(self):
223223

224224
class Equals:
225225
def setup(self):
226-
idx_large_fast = RangeIndex(100000)
227-
idx_small_slow = date_range(start="1/1/2012", periods=1)
228-
self.mi_large_slow = MultiIndex.from_product([idx_large_fast, idx_small_slow])
229-
226+
self.mi = MultiIndex.from_product(
227+
[
228+
date_range("2000-01-01", periods=1000),
229+
RangeIndex(1000),
230+
]
231+
)
232+
self.mi_deepcopy = self.mi.copy(deep=True)
230233
self.idx_non_object = RangeIndex(1)
231234

235+
def time_equals_deepcopy(self):
236+
self.mi.equals(self.mi_deepcopy)
237+
232238
def time_equals_non_object_index(self):
233-
self.mi_large_slow.equals(self.idx_non_object)
239+
self.mi.equals(self.idx_non_object)
234240

235241

236242
class SetOperations:

asv_bench/benchmarks/strings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def setup(self, dtype):
2121
self.s = Series(
2222
Index([f"i-{i}" for i in range(10000)], dtype=object), dtype=dtype
2323
)
24-
except ImportError:
25-
raise NotImplementedError
24+
except ImportError as err:
25+
raise NotImplementedError from err
2626

2727

2828
class Construction:

ci/code_checks.sh

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,130 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
7777
pandas.DataFrame.to_sql # There should be no backslash in the final line, please keep this comment in the last ignored function
7878
RET=$(($RET + $?)) ; echo $MSG "DONE"
7979

80+
MSG='Partially validate docstrings (PR02)' ; echo $MSG
81+
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=PR02 --ignore_functions \
82+
pandas.io.formats.style.Styler.to_excel\
83+
pandas.CategoricalIndex.rename_categories\
84+
pandas.CategoricalIndex.reorder_categories\
85+
pandas.CategoricalIndex.add_categories\
86+
pandas.CategoricalIndex.remove_categories\
87+
pandas.CategoricalIndex.set_categories\
88+
pandas.IntervalIndex.set_closed\
89+
pandas.IntervalIndex.contains\
90+
pandas.IntervalIndex.overlaps\
91+
pandas.IntervalIndex.to_tuples\
92+
pandas.DatetimeIndex.round\
93+
pandas.DatetimeIndex.floor\
94+
pandas.DatetimeIndex.ceil\
95+
pandas.DatetimeIndex.month_name\
96+
pandas.DatetimeIndex.day_name\
97+
pandas.DatetimeIndex.to_period\
98+
pandas.DatetimeIndex.std\
99+
pandas.TimedeltaIndex.round\
100+
pandas.TimedeltaIndex.floor\
101+
pandas.TimedeltaIndex.ceil\
102+
pandas.PeriodIndex\
103+
pandas.PeriodIndex.strftime\
104+
pandas.Series.clip\
105+
pandas.Series.rename_axis\
106+
pandas.Series.interpolate\
107+
pandas.Series.dt.to_period\
108+
pandas.Series.dt.tz_localize\
109+
pandas.Series.dt.tz_convert\
110+
pandas.Series.dt.strftime\
111+
pandas.Series.dt.round\
112+
pandas.Series.dt.floor\
113+
pandas.Series.dt.ceil\
114+
pandas.Series.dt.month_name\
115+
pandas.Series.dt.day_name\
116+
pandas.Series.str.wrap\
117+
pandas.Series.cat.rename_categories\
118+
pandas.Series.cat.reorder_categories\
119+
pandas.Series.cat.add_categories\
120+
pandas.Series.cat.remove_categories\
121+
pandas.Series.cat.set_categories\
122+
pandas.Series.plot\
123+
pandas.Series.plot.bar\
124+
pandas.Series.plot.barh\
125+
pandas.Series.plot.line\
126+
pandas.Series.plot.pie\
127+
pandas.DataFrame.clip\
128+
pandas.DataFrame.plot\
129+
pandas.DataFrame.plot.bar\
130+
pandas.DataFrame.plot.barh\
131+
pandas.DataFrame.plot.line\
132+
pandas.DataFrame.plot.pie\
133+
pandas.tseries.offsets.DateOffset\
134+
pandas.tseries.offsets.BusinessDay\
135+
pandas.tseries.offsets.BDay\
136+
pandas.tseries.offsets.BusinessHour\
137+
pandas.tseries.offsets.CustomBusinessDay\
138+
pandas.tseries.offsets.CDay\
139+
pandas.tseries.offsets.CustomBusinessHour\
140+
pandas.tseries.offsets.MonthEnd\
141+
pandas.tseries.offsets.MonthBegin\
142+
pandas.tseries.offsets.BusinessMonthEnd\
143+
pandas.tseries.offsets.BMonthEnd\
144+
pandas.tseries.offsets.BusinessMonthBegin\
145+
pandas.tseries.offsets.BMonthBegin\
146+
pandas.tseries.offsets.CustomBusinessMonthEnd\
147+
pandas.tseries.offsets.CBMonthEnd\
148+
pandas.tseries.offsets.CustomBusinessMonthBegin\
149+
pandas.tseries.offsets.CBMonthBegin\
150+
pandas.tseries.offsets.SemiMonthEnd\
151+
pandas.tseries.offsets.SemiMonthBegin\
152+
pandas.tseries.offsets.Week\
153+
pandas.tseries.offsets.WeekOfMonth\
154+
pandas.tseries.offsets.LastWeekOfMonth\
155+
pandas.tseries.offsets.BQuarterEnd\
156+
pandas.tseries.offsets.BQuarterBegin\
157+
pandas.tseries.offsets.QuarterEnd\
158+
pandas.tseries.offsets.QuarterBegin\
159+
pandas.tseries.offsets.BYearEnd\
160+
pandas.tseries.offsets.BYearBegin\
161+
pandas.tseries.offsets.YearEnd\
162+
pandas.tseries.offsets.YearBegin\
163+
pandas.tseries.offsets.FY5253\
164+
pandas.tseries.offsets.FY5253Quarter\
165+
pandas.tseries.offsets.Easter\
166+
pandas.tseries.offsets.Day\
167+
pandas.tseries.offsets.Hour\
168+
pandas.tseries.offsets.Minute\
169+
pandas.tseries.offsets.Second\
170+
pandas.tseries.offsets.Milli\
171+
pandas.tseries.offsets.Micro\
172+
pandas.tseries.offsets.Nano\
173+
pandas.describe_option\
174+
pandas.reset_option\
175+
pandas.get_option\
176+
pandas.set_option\
177+
pandas.Timestamp.max\
178+
pandas.Timestamp.min\
179+
pandas.Timestamp.resolution\
180+
pandas.Timedelta.max\
181+
pandas.Timedelta.min\
182+
pandas.Timedelta.resolution\
183+
pandas.Interval\
184+
pandas.Grouper\
185+
pandas.core.groupby.SeriesGroupBy.apply\
186+
pandas.core.groupby.SeriesGroupBy.transform\
187+
pandas.core.groupby.DataFrameGroupBy.transform\
188+
pandas.core.groupby.DataFrameGroupBy.nth\
189+
pandas.core.groupby.DataFrameGroupBy.rolling\
190+
pandas.core.groupby.SeriesGroupBy.idxmax\
191+
pandas.core.groupby.SeriesGroupBy.idxmin\
192+
pandas.core.groupby.SeriesGroupBy.nth\
193+
pandas.core.groupby.SeriesGroupBy.rolling\
194+
pandas.core.groupby.DataFrameGroupBy.hist\
195+
pandas.core.groupby.DataFrameGroupBy.plot\
196+
pandas.core.groupby.SeriesGroupBy.plot\
197+
pandas.read_hdf\
198+
pandas.HDFStore.append\
199+
pandas.core.window.rolling.Rolling.quantile\
200+
pandas.core.window.expanding.Expanding.quantile\
201+
pandas.api.extensions.ExtensionArray.argsort # There should be no backslash in the final line, please keep this comment in the last ignored function
202+
RET=$(($RET + $?)) ; echo $MSG "DONE"
203+
80204
fi
81205

82206
### DOCUMENTATION NOTEBOOKS ###

ci/run_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ echo PYTHONHASHSEED=$PYTHONHASHSEED
1010

1111
COVERAGE="-s --cov=pandas --cov-report=xml --cov-append --cov-config=pyproject.toml"
1212

13-
PYTEST_CMD="MESONPY_EDITABLE_VERBOSE=1 PYTHONDEVMODE=1 PYTHONWARNDEFAULTENCODING=1 pytest -r fEs -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE $PYTEST_TARGET"
13+
PYTEST_CMD="MESONPY_EDITABLE_VERBOSE=1 PYTHONDEVMODE=1 PYTHONWARNDEFAULTENCODING=1 pytest -r fE -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE $PYTEST_TARGET"
1414

1515
if [[ "$PATTERN" ]]; then
1616
PYTEST_CMD="$PYTEST_CMD -m \"$PATTERN\""

doc/source/whatsnew/v2.2.1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ including other versions of pandas.
1313

1414
Fixed regressions
1515
~~~~~~~~~~~~~~~~~
16-
-
16+
- Fixed regression in :func:`merge_ordered` raising ``TypeError`` for ``fill_method="ffill"`` and ``how="left"`` (:issue:`57010`)
1717

1818
.. ---------------------------------------------------------------------------
1919
.. _whatsnew_221.bug_fixes:

doc/source/whatsnew/v3.0.0.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,17 @@ Performance improvements
106106
- Performance improvement in :meth:`DataFrame.join` with ``how="left"`` or ``how="right"`` and ``sort=True`` (:issue:`56919`)
107107
- Performance improvement in :meth:`DataFrameGroupBy.ffill`, :meth:`DataFrameGroupBy.bfill`, :meth:`SeriesGroupBy.ffill`, and :meth:`SeriesGroupBy.bfill` (:issue:`56902`)
108108
- Performance improvement in :meth:`Index.take` when ``indices`` is a full range indexer from zero to length of index (:issue:`56806`)
109+
- Performance improvement in :meth:`MultiIndex.equals` for equal length indexes (:issue:`56990`)
109110
-
110111

111112
.. ---------------------------------------------------------------------------
112113
.. _whatsnew_300.bug_fixes:
113114

114115
Bug fixes
115116
~~~~~~~~~
117+
- Fixed bug in :meth:`DataFrame.join` inconsistently setting result index name (:issue:`55815`)
116118
- Fixed bug in :meth:`Series.diff` allowing non-integer values for the ``periods`` argument. (:issue:`56607`)
117-
119+
-
118120

119121
Categorical
120122
^^^^^^^^^^^

pandas/compat/_optional.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ def import_optional_dependency(
160160
)
161161
try:
162162
module = importlib.import_module(name)
163-
except ImportError:
163+
except ImportError as err:
164164
if errors == "raise":
165-
raise ImportError(msg)
165+
raise ImportError(msg) from err
166166
return None
167167

168168
# Handle submodules: if we have submodule, grab parent module from sys.modules

pandas/core/array_algos/datetimelike_accumulations.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ def _cum_func(
3737
np.cumsum: 0,
3838
np.minimum.accumulate: np.iinfo(np.int64).max,
3939
}[func]
40-
except KeyError:
41-
raise ValueError(f"No accumulation for {func} implemented on BaseMaskedArray")
40+
except KeyError as err:
41+
raise ValueError(
42+
f"No accumulation for {func} implemented on BaseMaskedArray"
43+
) from err
4244

4345
mask = isna(values)
4446
y = values.view("i8")

0 commit comments

Comments
 (0)