Skip to content

Commit 4b136e2

Browse files
Merge remote-tracking branch 'upstream/main' into pandas.Timestamp.round
Co-authored-by: @mroeschke
2 parents 72db078 + 283a2dc commit 4b136e2

26 files changed

+91
-97
lines changed

.github/workflows/wheels.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ jobs:
140140
run: echo "sdist_name=$(cd ./dist && ls -d */)" >> "$GITHUB_ENV"
141141

142142
- name: Build wheels
143-
uses: pypa/cibuildwheel@v2.17.0
143+
uses: pypa/cibuildwheel@v2.18.0
144144
with:
145145
package-dir: ./dist/${{ startsWith(matrix.buildplat[1], 'macosx') && env.sdist_name || needs.build_sdist.outputs.sdist_file }}
146146
env:

ci/code_checks.sh

-6
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
138138
-i "pandas.RangeIndex.start SA01" \
139139
-i "pandas.RangeIndex.step SA01" \
140140
-i "pandas.RangeIndex.stop SA01" \
141-
-i "pandas.Series.case_when RT03" \
142141
-i "pandas.Series.cat.add_categories PR01,PR02" \
143142
-i "pandas.Series.cat.as_ordered PR01" \
144143
-i "pandas.Series.cat.as_unordered PR01" \
@@ -229,7 +228,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
229228
-i "pandas.Series.str.strip RT03" \
230229
-i "pandas.Series.str.swapcase RT03" \
231230
-i "pandas.Series.str.title RT03" \
232-
-i "pandas.Series.str.translate RT03,SA01" \
233231
-i "pandas.Series.str.upper RT03" \
234232
-i "pandas.Series.str.wrap RT03,SA01" \
235233
-i "pandas.Series.str.zfill RT03" \
@@ -323,7 +321,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
323321
-i "pandas.api.extensions.ExtensionArray._reduce RT03,SA01" \
324322
-i "pandas.api.extensions.ExtensionArray._values_for_factorize SA01" \
325323
-i "pandas.api.extensions.ExtensionArray.astype SA01" \
326-
-i "pandas.api.extensions.ExtensionArray.copy RT03,SA01" \
327324
-i "pandas.api.extensions.ExtensionArray.dropna RT03,SA01" \
328325
-i "pandas.api.extensions.ExtensionArray.dtype SA01" \
329326
-i "pandas.api.extensions.ExtensionArray.duplicated RT03,SA01" \
@@ -336,7 +333,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
336333
-i "pandas.api.extensions.ExtensionArray.nbytes SA01" \
337334
-i "pandas.api.extensions.ExtensionArray.ndim SA01" \
338335
-i "pandas.api.extensions.ExtensionArray.ravel RT03,SA01" \
339-
-i "pandas.api.extensions.ExtensionArray.shape SA01" \
340336
-i "pandas.api.extensions.ExtensionArray.shift SA01" \
341337
-i "pandas.api.extensions.ExtensionArray.take RT03" \
342338
-i "pandas.api.extensions.ExtensionArray.tolist RT03,SA01" \
@@ -568,7 +564,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
568564
-i "pandas.tseries.offsets.BQuarterEnd.normalize GL08" \
569565
-i "pandas.tseries.offsets.BQuarterEnd.rule_code GL08" \
570566
-i "pandas.tseries.offsets.BQuarterEnd.startingMonth GL08" \
571-
-i "pandas.tseries.offsets.BYearBegin PR02" \
572567
-i "pandas.tseries.offsets.BYearBegin.freqstr SA01" \
573568
-i "pandas.tseries.offsets.BYearBegin.is_on_offset GL08" \
574569
-i "pandas.tseries.offsets.BYearBegin.month GL08" \
@@ -835,7 +830,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
835830
-i "pandas.tseries.offsets.WeekOfMonth.rule_code GL08" \
836831
-i "pandas.tseries.offsets.WeekOfMonth.week GL08" \
837832
-i "pandas.tseries.offsets.WeekOfMonth.weekday GL08" \
838-
-i "pandas.tseries.offsets.YearBegin PR02" \
839833
-i "pandas.tseries.offsets.YearBegin.freqstr SA01" \
840834
-i "pandas.tseries.offsets.YearBegin.is_on_offset GL08" \
841835
-i "pandas.tseries.offsets.YearBegin.month GL08" \

doc/source/development/policies.rst

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ deprecation removed in the next major release (2.0.0).
4646
These policies do not apply to features marked as **experimental** in the documentation.
4747
pandas may change the behavior of experimental features at any time.
4848

49+
.. _policies.python_support:
50+
4951
Python support
5052
~~~~~~~~~~~~~~
5153

doc/source/getting_started/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Instructions for installing :ref:`from source <install.source>`,
2121
Python version support
2222
----------------------
2323

24-
Officially Python 3.9, 3.10, 3.11 and 3.12.
24+
See :ref:`Python support policy <policies.python_support>`.
2525

2626
Installing pandas
2727
-----------------

doc/source/getting_started/intro_tutorials/01_table_oriented.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ Check more options on ``describe`` in the user guide section about :ref:`aggrega
192192
.. note::
193193
This is just a starting point. Similar to spreadsheet
194194
software, pandas represents data as a table with columns and rows. Apart
195-
from the representation, also the data manipulations and calculations
196-
you would do in spreadsheet software are supported by pandas. Continue
195+
from the representation, the data manipulations and calculations
196+
you would do in spreadsheet software are also supported by pandas. Continue
197197
reading the next tutorials to get started!
198198

199199
.. raw:: html
@@ -204,7 +204,7 @@ Check more options on ``describe`` in the user guide section about :ref:`aggrega
204204
- Import the package, aka ``import pandas as pd``
205205
- A table of data is stored as a pandas ``DataFrame``
206206
- Each column in a ``DataFrame`` is a ``Series``
207-
- You can do things by applying a method to a ``DataFrame`` or ``Series``
207+
- You can do things by applying a method on a ``DataFrame`` or ``Series``
208208

209209
.. raw:: html
210210

@@ -215,7 +215,7 @@ Check more options on ``describe`` in the user guide section about :ref:`aggrega
215215
<div class="d-flex flex-row gs-torefguide">
216216
<span class="badge badge-info">To user guide</span>
217217

218-
A more extended explanation to ``DataFrame`` and ``Series`` is provided in the :ref:`introduction to data structures <dsintro>`.
218+
A more extended explanation of ``DataFrame`` and ``Series`` is provided in the :ref:`introduction to data structures <dsintro>` page.
219219

220220
.. raw:: html
221221

doc/source/getting_started/intro_tutorials/02_read_write.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ The method :meth:`~DataFrame.info` provides technical information about a
172172
- The table has 12 columns. Most columns have a value for each of the
173173
rows (all 891 values are ``non-null``). Some columns do have missing
174174
values and less than 891 ``non-null`` values.
175-
- The columns ``Name``, ``Sex``, ``Cabin`` and ``Embarked`` consists of
175+
- The columns ``Name``, ``Sex``, ``Cabin`` and ``Embarked`` consist of
176176
textual data (strings, aka ``object``). The other columns are
177-
numerical data with some of them whole numbers (aka ``integer``) and
178-
others are real numbers (aka ``float``).
179-
- The kind of data (characters, integers,…) in the different columns
177+
numerical data, some of them are whole numbers (``integer``) and
178+
others are real numbers (``float``).
179+
- The kind of data (characters, integers, …) in the different columns
180180
are summarized by listing the ``dtypes``.
181181
- The approximate amount of RAM used to hold the DataFrame is provided
182182
as well.
@@ -194,7 +194,7 @@ The method :meth:`~DataFrame.info` provides technical information about a
194194
- Getting data in to pandas from many different file formats or data
195195
sources is supported by ``read_*`` functions.
196196
- Exporting data out of pandas is provided by different
197-
``to_*``\ methods.
197+
``to_*`` methods.
198198
- The ``head``/``tail``/``info`` methods and the ``dtypes`` attribute
199199
are convenient for a first check.
200200

doc/source/getting_started/intro_tutorials/03_subset_data.rst

+4-6
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ want to select.
300300
</li>
301301
</ul>
302302

303-
When using the column names, row labels or a condition expression, use
303+
When using column names, row labels or a condition expression, use
304304
the ``loc`` operator in front of the selection brackets ``[]``. For both
305305
the part before and after the comma, you can use a single label, a list
306306
of labels, a slice of labels, a conditional expression or a colon. Using
@@ -342,7 +342,7 @@ the name ``anonymous`` to the first 3 elements of the fourth column:
342342
<div class="d-flex flex-row gs-torefguide">
343343
<span class="badge badge-info">To user guide</span>
344344

345-
See the user guide section on :ref:`different choices for indexing <indexing.choice>` to get more insight in the usage of ``loc`` and ``iloc``.
345+
See the user guide section on :ref:`different choices for indexing <indexing.choice>` to get more insight into the usage of ``loc`` and ``iloc``.
346346

347347
.. raw:: html
348348

@@ -357,10 +357,8 @@ See the user guide section on :ref:`different choices for indexing <indexing.cho
357357
- Inside these square brackets, you can use a single column/row label, a list
358358
of column/row labels, a slice of labels, a conditional expression or
359359
a colon.
360-
- Select specific rows and/or columns using ``loc`` when using the row
361-
and column names.
362-
- Select specific rows and/or columns using ``iloc`` when using the
363-
positions in the table.
360+
- Use ``loc`` for label-based selection (using row/column names).
361+
- Use ``iloc`` for position-based selection (using table positions).
364362
- You can assign new values to a selection based on ``loc``/``iloc``.
365363

366364
.. raw:: html

doc/source/getting_started/intro_tutorials/04_plotting.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ I want to plot only the columns of the data table with the data from Paris.
8585
air_quality["station_paris"].plot()
8686
plt.show()
8787
88-
To plot a specific column, use the selection method of the
88+
To plot a specific column, use a selection method from the
8989
:ref:`subset data tutorial <10min_tut_03_subset>` in combination with the :meth:`~DataFrame.plot`
9090
method. Hence, the :meth:`~DataFrame.plot` method works on both ``Series`` and
9191
``DataFrame``.
@@ -127,7 +127,7 @@ standard Python to get an overview of the available plot methods:
127127
]
128128
129129
.. note::
130-
In many development environments as well as IPython and
130+
In many development environments such as IPython and
131131
Jupyter Notebook, use the TAB button to get an overview of the available
132132
methods, for example ``air_quality.plot.`` + TAB.
133133

@@ -238,7 +238,7 @@ This strategy is applied in the previous example:
238238

239239
- The ``.plot.*`` methods are applicable on both Series and DataFrames.
240240
- By default, each of the columns is plotted as a different element
241-
(line, boxplot,…).
241+
(line, boxplot, …).
242242
- Any plot created by pandas is a Matplotlib object.
243243

244244
.. raw:: html

doc/source/getting_started/intro_tutorials/05_add_columns.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ values in each row*.
8989
</li>
9090
</ul>
9191

92-
Also other mathematical operators (``+``, ``-``, ``*``, ``/``,…) or
93-
logical operators (``<``, ``>``, ``==``,…) work element-wise. The latter was already
92+
Other mathematical operators (``+``, ``-``, ``*``, ``/``, …) and logical
93+
operators (``<``, ``>``, ``==``, …) also work element-wise. The latter was already
9494
used in the :ref:`subset data tutorial <10min_tut_03_subset>` to filter
9595
rows of a table using a conditional expression.
9696

doc/source/getting_started/intro_tutorials/06_calculate_statistics.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ category in a column.
235235
</li>
236236
</ul>
237237

238-
The function is a shortcut, as it is actually a groupby operation in combination with counting of the number of records
238+
The function is a shortcut, it is actually a groupby operation in combination with counting the number of records
239239
within each group:
240240

241241
.. ipython:: python

doc/source/getting_started/intro_tutorials/08_combine_dataframes.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Hence, the resulting table has 3178 = 1110 + 2068 rows.
137137
Most operations like concatenation or summary statistics are by default
138138
across rows (axis 0), but can be applied across columns as well.
139139

140-
Sorting the table on the datetime information illustrates also the
140+
Sorting the table on the datetime information also illustrates the
141141
combination of both tables, with the ``parameter`` column defining the
142142
origin of the table (either ``no2`` from table ``air_quality_no2`` or
143143
``pm25`` from table ``air_quality_pm25``):
@@ -286,7 +286,7 @@ between the two tables.
286286
<div class="d-flex flex-row gs-torefguide">
287287
<span class="badge badge-info">To user guide</span>
288288

289-
pandas supports also inner, outer, and right joins.
289+
pandas also supports inner, outer, and right joins.
290290
More information on join/merge of tables is provided in the user guide section on
291291
:ref:`database style merging of tables <merging.join>`. Or have a look at the
292292
:ref:`comparison with SQL<compare_with_sql.join>` page.
@@ -300,7 +300,7 @@ More information on join/merge of tables is provided in the user guide section o
300300
<div class="shadow gs-callout gs-callout-remember">
301301
<h4>REMEMBER</h4>
302302

303-
- Multiple tables can be concatenated both column-wise and row-wise using
303+
- Multiple tables can be concatenated column-wise or row-wise using
304304
the ``concat`` function.
305305
- For database-like merging/joining of tables, use the ``merge``
306306
function.

doc/source/getting_started/intro_tutorials/09_timeseries.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ I want to work with the dates in the column ``datetime`` as datetime objects ins
7777
7878
Initially, the values in ``datetime`` are character strings and do not
7979
provide any datetime operations (e.g. extract the year, day of the
80-
week,…). By applying the ``to_datetime`` function, pandas interprets the
80+
week, …). By applying the ``to_datetime`` function, pandas interprets the
8181
strings and convert these to datetime (i.e. ``datetime64[ns, UTC]``)
82-
objects. In pandas we call these datetime objects similar to
82+
objects. In pandas we call these datetime objects that are similar to
8383
``datetime.datetime`` from the standard library as :class:`pandas.Timestamp`.
8484

8585
.. raw:: html
@@ -117,7 +117,7 @@ length of our time series:
117117
air_quality["datetime"].max() - air_quality["datetime"].min()
118118
119119
The result is a :class:`pandas.Timedelta` object, similar to ``datetime.timedelta``
120-
from the standard Python library and defining a time duration.
120+
from the standard Python library which defines a time duration.
121121

122122
.. raw:: html
123123

@@ -257,7 +257,7 @@ the adapted time scale on plots. Let’s apply this on our data.
257257
<ul class="task-bullet">
258258
<li>
259259

260-
Create a plot of the :math:`NO_2` values in the different stations from the 20th of May till the end of 21st of May
260+
Create a plot of the :math:`NO_2` values in the different stations from May 20th till the end of May 21st.
261261

262262
.. ipython:: python
263263
:okwarning:
@@ -310,7 +310,7 @@ converting secondly data into 5-minutely data).
310310
The :meth:`~Series.resample` method is similar to a groupby operation:
311311

312312
- it provides a time-based grouping, by using a string (e.g. ``M``,
313-
``5H``,…) that defines the target frequency
313+
``5H``, …) that defines the target frequency
314314
- it requires an aggregation function such as ``mean``, ``max``,…
315315

316316
.. raw:: html

doc/source/getting_started/intro_tutorials/10_text_data.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ only one countess on the Titanic, we get one row as a result.
134134
.. note::
135135
More powerful extractions on strings are supported, as the
136136
:meth:`Series.str.contains` and :meth:`Series.str.extract` methods accept `regular
137-
expressions <https://docs.python.org/3/library/re.html>`__, but out of
138-
scope of this tutorial.
137+
expressions <https://docs.python.org/3/library/re.html>`__, but are out of
138+
the scope of this tutorial.
139139

140140
.. raw:: html
141141

@@ -200,7 +200,7 @@ In the "Sex" column, replace values of "male" by "M" and values of "female" by "
200200
201201
Whereas :meth:`~Series.replace` is not a string method, it provides a convenient way
202202
to use mappings or vocabularies to translate certain values. It requires
203-
a ``dictionary`` to define the mapping ``{from : to}``.
203+
a ``dictionary`` to define the mapping ``{from: to}``.
204204

205205
.. raw:: html
206206

doc/source/user_guide/merging.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ compare two :class:`DataFrame` or :class:`Series`, respectively, and summarize t
10731073
df.compare(df2)
10741074
10751075
By default, if two corresponding values are equal, they will be shown as ``NaN``.
1076-
Furthermore, if all values in an entire row / column, the row / column will be
1076+
Furthermore, if all values in an entire row / column are equal, that row / column will be
10771077
omitted from the result. The remaining differences will be aligned on columns.
10781078

10791079
Stack the differences on rows.

doc/source/whatsnew/v0.13.0.rst

-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,6 @@ Float64Index API change
345345
.. ipython:: python
346346
:okwarning:
347347
348-
s[2:4]
349348
s.loc[2:4]
350349
s.iloc[2:4]
351350

doc/source/whatsnew/v3.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ Removal of prior version deprecations/changes
225225
- All arguments except ``name`` in :meth:`Index.rename` are now keyword only (:issue:`56493`)
226226
- All arguments except the first ``path``-like argument in IO writers are now keyword only (:issue:`54229`)
227227
- Changed behavior of :meth:`Series.__getitem__` and :meth:`Series.__setitem__` to always treat integer keys as labels, never as positional, consistent with :class:`DataFrame` behavior (:issue:`50617`)
228+
- Changed behavior of :meth:`Series.__getitem__`, :meth:`Series.__setitem__`, :meth:`DataFrame.__getitem__`, :meth:`DataFrame.__setitem__` with an integer slice on objects with a floating-dtype index. This is now treated as *positional* indexing (:issue:`49612`)
228229
- Disallow a callable argument to :meth:`Series.iloc` to return a ``tuple`` (:issue:`53769`)
229230
- Disallow allowing logical operations (``||``, ``&``, ``^``) between pandas objects and dtype-less sequences (e.g. ``list``, ``tuple``); wrap the objects in :class:`Series`, :class:`Index`, or ``np.array`` first instead (:issue:`52264`)
230231
- Disallow automatic casting to object in :class:`Series` logical operations (``&``, ``^``, ``||``) between series with mismatched indexes and dtypes other than ``object`` or ``bool`` (:issue:`52538`)

pandas/_libs/tslibs/offsets.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2538,7 +2538,7 @@ cdef class BYearBegin(YearOffset):
25382538
"""
25392539
DateOffset increments between the first business day of the year.
25402540
2541-
Parameters
2541+
Attributes
25422542
----------
25432543
n : int, default 1
25442544
The number of years represented.
@@ -2633,7 +2633,7 @@ cdef class YearBegin(YearOffset):
26332633
26342634
YearBegin goes to the next date which is the start of the year.
26352635
2636-
Parameters
2636+
Attributes
26372637
----------
26382638
n : int, default 1
26392639
The number of years represented.

pandas/core/arrays/base.py

+17
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,13 @@ def shape(self) -> Shape:
610610
"""
611611
Return a tuple of the array dimensions.
612612
613+
See Also
614+
--------
615+
numpy.ndarray.shape : Similar attribute which returns the shape of an array.
616+
DataFrame.shape : Return a tuple representing the dimensionality of the
617+
DataFrame.
618+
Series.shape : Return a tuple representing the dimensionality of the Series.
619+
613620
Examples
614621
--------
615622
>>> arr = pd.array([1, 2, 3])
@@ -1604,9 +1611,19 @@ def copy(self) -> Self:
16041611
"""
16051612
Return a copy of the array.
16061613
1614+
This method creates a copy of the `ExtensionArray` where modifying the
1615+
data in the copy will not affect the original array. This is useful when
1616+
you want to manipulate data without altering the original dataset.
1617+
16071618
Returns
16081619
-------
16091620
ExtensionArray
1621+
A new `ExtensionArray` object that is a copy of the current instance.
1622+
1623+
See Also
1624+
--------
1625+
DataFrame.copy : Return a copy of the DataFrame.
1626+
Series.copy : Return a copy of the Series.
16101627
16111628
Examples
16121629
--------

pandas/core/indexes/base.py

-19
Original file line numberDiff line numberDiff line change
@@ -4005,25 +4005,6 @@ def _convert_slice_indexer(self, key: slice, kind: Literal["loc", "getitem"]):
40054005

40064006
# TODO(GH#50617): once Series.__[gs]etitem__ is removed we should be able
40074007
# to simplify this.
4008-
if lib.is_np_dtype(self.dtype, "f"):
4009-
# We always treat __getitem__ slicing as label-based
4010-
# translate to locations
4011-
if kind == "getitem" and is_index_slice and not start == stop and step != 0:
4012-
# exclude step=0 from the warning because it will raise anyway
4013-
# start/stop both None e.g. [:] or [::-1] won't change.
4014-
# exclude start==stop since it will be empty either way, or
4015-
# will be [:] or [::-1] which won't change
4016-
warnings.warn(
4017-
# GH#49612
4018-
"The behavior of obj[i:j] with a float-dtype index is "
4019-
"deprecated. In a future version, this will be treated as "
4020-
"positional instead of label-based. For label-based slicing, "
4021-
"use obj.loc[i:j] instead",
4022-
FutureWarning,
4023-
stacklevel=find_stack_level(),
4024-
)
4025-
return self.slice_indexer(start, stop, step)
4026-
40274008
if kind == "getitem":
40284009
# called from the getitem slicers, validate that we are in fact integers
40294010
if is_index_slice:

0 commit comments

Comments
 (0)