Skip to content

Commit d009b81

Browse files
committed
Merge remote-tracking branch 'upstream/main' into tst/cln/unneeded_pa_checking
2 parents 1af89ab + 3f2b18a commit d009b81

Some content is hidden

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

55 files changed

+85
-237
lines changed

ci/code_checks.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,9 +574,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
574574
pandas.api.types.is_datetime64_ns_dtype \
575575
pandas.api.types.is_datetime64tz_dtype \
576576
pandas.api.types.is_integer_dtype \
577-
pandas.api.types.is_interval_dtype \
578-
pandas.api.types.is_period_dtype \
579-
pandas.api.types.is_signed_integer_dtype \
580577
pandas.api.types.is_sparse \
581578
pandas.api.types.is_string_dtype \
582579
pandas.api.types.is_unsigned_integer_dtype \

doc/source/development/copy_on_write.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ behaves as a copy.
1414
Reference tracking
1515
------------------
1616

17-
To be able to determine, if we have to make a copy when writing into a DataFrame,
18-
we have to be aware, if the values are shared with another DataFrame. pandas
17+
To be able to determine if we have to make a copy when writing into a DataFrame,
18+
we have to be aware if the values are shared with another DataFrame. pandas
1919
keeps track of all ``Blocks`` that share values with another block internally to
2020
be able to tell when a copy needs to be triggered. The reference tracking
2121
mechanism is implemented on the Block level.
2222

2323
We use a custom reference tracker object, ``BlockValuesRefs``, that keeps
2424
track of every block, whose values share memory with each other. The reference
25-
is held through a weak-reference. Every two blocks that share some memory should
25+
is held through a weak-reference. Every pair of blocks that share some memory should
2626
point to the same ``BlockValuesRefs`` object. If one block goes out of
2727
scope, the reference to this block dies. As a consequence, the reference tracker
2828
object always knows how many blocks are alive and share memory.

doc/source/development/policies.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ Policies
99
Version policy
1010
~~~~~~~~~~~~~~
1111

12-
.. versionchanged:: 1.0.0
13-
1412
pandas uses a loose variant of semantic versioning (`SemVer`_) to govern
1513
deprecations, API compatibility, and version numbering.
1614

doc/source/user_guide/boolean.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ Nullable Boolean data type
1717
BooleanArray is currently experimental. Its API or implementation may
1818
change without warning.
1919

20-
.. versionadded:: 1.0.0
21-
22-
2320
.. _boolean.indexing:
2421

2522
Indexing with NA values

doc/source/user_guide/indexing.rst

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,6 @@ Selection by label
311311
312312
dfl.loc['20130102':'20130104']
313313
314-
.. warning::
315-
316-
.. versionchanged:: 1.0.0
317-
318-
pandas will raise a ``KeyError`` if indexing with a list with missing labels. See :ref:`list-like Using loc with
319-
missing keys in a list is Deprecated <indexing.deprecate_loc_reindex_listlike>`.
320-
321314
pandas provides a suite of methods in order to have **purely label based indexing**. This is a strict inclusion based protocol.
322315
Every label asked for must be in the index, or a ``KeyError`` will be raised.
323316
When slicing, both the start bound **AND** the stop bound are *included*, if present in the index.
@@ -622,12 +615,6 @@ For getting *multiple* indexers, using ``.get_indexer``:
622615
Indexing with list with missing labels is deprecated
623616
----------------------------------------------------
624617

625-
.. warning::
626-
627-
.. versionchanged:: 1.0.0
628-
629-
Using ``.loc`` or ``[]`` with a list with one or more missing labels will no longer reindex, in favor of ``.reindex``.
630-
631618
In prior versions, using ``.loc[list-of-labels]`` would work as long as *at least 1* of the keys was found (otherwise it
632619
would raise a ``KeyError``). This behavior was changed and will now raise a ``KeyError`` if at least one label is missing.
633620
The recommended alternative is to use ``.reindex()``.

doc/source/user_guide/integer_na.rst

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@ Nullable integer data type
1111
.. note::
1212

1313
IntegerArray is currently experimental. Its API or implementation may
14-
change without warning.
15-
16-
.. versionchanged:: 1.0.0
17-
18-
Now uses :attr:`pandas.NA` as the missing value rather
19-
than :attr:`numpy.nan`.
14+
change without warning. Uses :attr:`pandas.NA` as the missing value.
2015

2116
In :ref:`missing_data`, we saw that pandas primarily uses ``NaN`` to represent
2217
missing data. Because ``NaN`` is a float, this forces an array of integers with

doc/source/user_guide/io.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3634,11 +3634,6 @@ It is often the case that users will insert columns to do temporary computations
36343634
in Excel and you may not want to read in those columns. ``read_excel`` takes
36353635
a ``usecols`` keyword to allow you to specify a subset of columns to parse.
36363636

3637-
.. versionchanged:: 1.0.0
3638-
3639-
Passing in an integer for ``usecols`` will no longer work. Please pass in a list
3640-
of ints from 0 to ``usecols`` inclusive instead.
3641-
36423637
You can specify a comma-delimited set of Excel columns and ranges as a string:
36433638

36443639
.. code-block:: python
@@ -3881,8 +3876,6 @@ Similarly, the :func:`~pandas.to_excel` method can write OpenDocument spreadshee
38813876
Binary Excel (.xlsb) files
38823877
--------------------------
38833878

3884-
.. versionadded:: 1.0.0
3885-
38863879
The :func:`~pandas.read_excel` method can also read binary Excel files
38873880
using the ``pyxlsb`` module. The semantics and features for reading
38883881
binary Excel files mostly match what can be done for `Excel files`_ using
@@ -5419,8 +5412,6 @@ The above example creates a partitioned dataset that may look like:
54195412
ORC
54205413
---
54215414

5422-
.. versionadded:: 1.0.0
5423-
54245415
Similar to the :ref:`parquet <io.parquet>` format, the `ORC Format <https://orc.apache.org/>`__ is a binary columnar serialization
54255416
for data frames. It is designed to make reading data frames efficient. pandas provides both the reader and the writer for the
54265417
ORC format, :func:`~pandas.read_orc` and :func:`~pandas.DataFrame.to_orc`. This requires the `pyarrow <https://arrow.apache.org/docs/python/>`__ library.

doc/source/user_guide/missing_data.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,6 @@ Experimental ``NA`` scalar to denote missing values
753753

754754
Experimental: the behaviour of ``pd.NA`` can still change without warning.
755755

756-
.. versionadded:: 1.0.0
757-
758756
Starting from pandas 1.0, an experimental ``pd.NA`` value (singleton) is
759757
available to represent scalar missing values. At this moment, it is used in
760758
the nullable :doc:`integer <integer_na>`, boolean and

doc/source/user_guide/text.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ Working with text data
1111
Text data types
1212
---------------
1313

14-
.. versionadded:: 1.0.0
15-
1614
There are two ways to store text data in pandas:
1715

1816
1. ``object`` -dtype NumPy array.

doc/source/user_guide/timeseries.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,6 @@ which can be specified. These are computed from the starting point specified by
335335
that was discussed :ref:`above<timeseries.converting.format>`). The
336336
available units are listed on the documentation for :func:`pandas.to_datetime`.
337337

338-
.. versionchanged:: 1.0.0
339-
340338
Constructing a :class:`Timestamp` or :class:`DatetimeIndex` with an epoch timestamp
341339
with the ``tz`` argument specified will raise a ValueError. If you have
342340
epochs in wall time in another timezone, you can read the epochs

doc/source/user_guide/visualization.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,8 +1318,6 @@ with "(right)" in the legend. To turn off the automatic marking, use the
13181318
Custom formatters for timeseries plots
13191319
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13201320

1321-
.. versionchanged:: 1.0.0
1322-
13231321
pandas provides custom formatters for timeseries plots. These change the
13241322
formatting of the axis labels for dates and times. By default,
13251323
the custom formatters are applied only to plots created by pandas with

doc/source/whatsnew/v2.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,7 @@ Other API changes
814814
- :func:`to_datetime` with ``unit`` of either "Y" or "M" will now raise if a sequence contains a non-round ``float`` value, matching the ``Timestamp`` behavior (:issue:`50301`)
815815
- The methods :meth:`Series.round`, :meth:`DataFrame.__invert__`, :meth:`Series.__invert__`, :meth:`DataFrame.swapaxes`, :meth:`DataFrame.first`, :meth:`DataFrame.last`, :meth:`Series.first`, :meth:`Series.last` and :meth:`DataFrame.align` will now always return new objects (:issue:`51032`)
816816
- :class:`DataFrame` and :class:`DataFrameGroupBy` aggregations (e.g. "sum") with object-dtype columns no longer infer non-object dtypes for their results, explicitly call ``result.infer_objects(copy=False)`` on the result to obtain the old behavior (:issue:`51205`, :issue:`49603`)
817+
- Division by zero with :class:`ArrowDtype` dtypes returns ``-inf``, ``nan``, or ``inf`` depending on the numerator, instead of raising (:issue:`51541`)
817818
- Added :func:`pandas.api.types.is_any_real_numeric_dtype` to check for real numeric dtypes (:issue:`51152`)
818819

819820
.. note::

doc/source/whatsnew/v2.1.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Other API changes
9292

9393
Deprecations
9494
~~~~~~~~~~~~
95-
-
95+
- Deprecated accepting slices in :meth:`DataFrame.take`, call ``obj[slicer]`` or pass a sequence of integers instead (:issue:`51539`)
9696
-
9797

9898
.. ---------------------------------------------------------------------------

pandas/_libs/missing.pyx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,6 @@ class NAType(C_NAType):
372372
373373
Experimental: the behaviour of NA can still change without warning.
374374
375-
.. versionadded:: 1.0.0
376-
377375
The NA singleton is a missing value indicator defined by pandas. It is
378376
used in certain new extension dtypes (currently the "string" dtype).
379377
"""

pandas/_testing/asserters.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,7 @@ def _get_ilevel_values(index, level):
279279
right = safe_sort_index(right)
280280

281281
# MultiIndex special comparison for little-friendly error messages
282-
if left.nlevels > 1:
283-
left = cast(MultiIndex, left)
282+
if isinstance(left, MultiIndex):
284283
right = cast(MultiIndex, right)
285284

286285
for level in range(left.nlevels):
@@ -303,7 +302,7 @@ def _get_ilevel_values(index, level):
303302
_check_types(left.levels[level], right.levels[level], obj=obj)
304303

305304
# skip exact index checking when `check_categorical` is False
306-
if check_exact and check_categorical:
305+
elif check_exact and check_categorical:
307306
if not left.equals(right):
308307
mismatch = left._values != right._values
309308

pandas/conftest.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,9 +637,7 @@ def index_flat(request):
637637
key
638638
for key, value in indices_dict.items()
639639
if not (
640-
key.startswith("int")
641-
or key.startswith("uint")
642-
or key.startswith("float")
640+
key.startswith(("int", "uint", "float"))
643641
or key in ["range", "empty", "repeats", "bool-dtype"]
644642
)
645643
and not isinstance(value, MultiIndex)

pandas/core/arrays/arrow/array.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def floordiv_compat(
106106
) -> pa.ChunkedArray:
107107
# Ensure int // int -> int mirroring Python/Numpy behavior
108108
# as pc.floor(pc.divide_checked(int, int)) -> float
109-
result = pc.floor(pc.divide_checked(left, right))
109+
result = pc.floor(pc.divide(left, right))
110110
if pa.types.is_integer(left.type) and pa.types.is_integer(right.type):
111111
result = result.cast(left.type)
112112
return result
@@ -118,8 +118,8 @@ def floordiv_compat(
118118
"rsub": lambda x, y: pc.subtract_checked(y, x),
119119
"mul": pc.multiply_checked,
120120
"rmul": lambda x, y: pc.multiply_checked(y, x),
121-
"truediv": lambda x, y: pc.divide_checked(cast_for_truediv(x, y), y),
122-
"rtruediv": lambda x, y: pc.divide_checked(y, cast_for_truediv(x, y)),
121+
"truediv": lambda x, y: pc.divide(cast_for_truediv(x, y), y),
122+
"rtruediv": lambda x, y: pc.divide(y, cast_for_truediv(x, y)),
123123
"floordiv": lambda x, y: floordiv_compat(x, y),
124124
"rfloordiv": lambda x, y: floordiv_compat(y, x),
125125
"mod": NotImplemented,

pandas/core/arrays/base.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,6 @@ def to_numpy(
462462
"""
463463
Convert to a NumPy ndarray.
464464
465-
.. versionadded:: 1.0.0
466-
467465
This is similar to :meth:`numpy.asarray`, but may provide additional control
468466
over how the conversion is done.
469467

pandas/core/arrays/boolean.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ class BooleanDtype(BaseMaskedDtype):
4343
"""
4444
Extension dtype for boolean data.
4545
46-
.. versionadded:: 1.0.0
47-
4846
.. warning::
4947
5048
BooleanDtype is considered experimental. The implementation and
@@ -246,8 +244,6 @@ class BooleanArray(BaseMaskedArray):
246244
:func:`pandas.array` specifying ``dtype="boolean"`` (see examples
247245
below).
248246
249-
.. versionadded:: 1.0.0
250-
251247
.. warning::
252248
253249
BooleanArray is considered experimental. The implementation and

pandas/core/arrays/categorical.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,18 +1987,14 @@ def min(self, *, skipna: bool = True, **kwargs):
19871987
19881988
Only ordered `Categoricals` have a minimum!
19891989
1990-
.. versionchanged:: 1.0.0
1991-
1992-
Returns an NA value on empty arrays
1993-
19941990
Raises
19951991
------
19961992
TypeError
19971993
If the `Categorical` is not `ordered`.
19981994
19991995
Returns
20001996
-------
2001-
min : the minimum of this `Categorical`
1997+
min : the minimum of this `Categorical`, NA value if empty
20021998
"""
20031999
nv.validate_minmax_axis(kwargs.get("axis", 0))
20042000
nv.validate_min((), kwargs)
@@ -2023,18 +2019,14 @@ def max(self, *, skipna: bool = True, **kwargs):
20232019
20242020
Only ordered `Categoricals` have a maximum!
20252021
2026-
.. versionchanged:: 1.0.0
2027-
2028-
Returns an NA value on empty arrays
2029-
20302022
Raises
20312023
------
20322024
TypeError
20332025
If the `Categorical` is not `ordered`.
20342026
20352027
Returns
20362028
-------
2037-
max : the maximum of this `Categorical`
2029+
max : the maximum of this `Categorical`, NA if array is empty
20382030
"""
20392031
nv.validate_minmax_axis(kwargs.get("axis", 0))
20402032
nv.validate_max((), kwargs)

pandas/core/arrays/integer.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class IntegerDtype(NumericDtype):
1616
An ExtensionDtype to hold a single size & kind of integer dtype.
1717
1818
These specific implementations are subclasses of the non-public
19-
IntegerDtype. For example we have Int8Dtype to represent signed int 8s.
19+
IntegerDtype. For example, we have Int8Dtype to represent signed int 8s.
2020
2121
The attributes name & type are set when these subclasses are created.
2222
"""
@@ -63,10 +63,7 @@ class IntegerArray(NumericArray):
6363
"""
6464
Array of integer (optional missing) values.
6565
66-
.. versionchanged:: 1.0.0
67-
68-
Now uses :attr:`pandas.NA` as the missing value rather
69-
than :attr:`numpy.nan`.
66+
Uses :attr:`pandas.NA` as the missing value.
7067
7168
.. warning::
7269
@@ -141,10 +138,7 @@ class IntegerArray(NumericArray):
141138
_dtype_docstring = """
142139
An ExtensionDtype for {dtype} integer data.
143140
144-
.. versionchanged:: 1.0.0
145-
146-
Now uses :attr:`pandas.NA` as its missing value,
147-
rather than :attr:`numpy.nan`.
141+
Uses :attr:`pandas.NA` as its missing value, rather than :attr:`numpy.nan`.
148142
149143
Attributes
150144
----------

pandas/core/arrays/string_.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ class StringDtype(StorageExtensionDtype):
7070
"""
7171
Extension dtype for string data.
7272
73-
.. versionadded:: 1.0.0
74-
7573
.. warning::
7674
7775
StringDtype is considered experimental. The implementation and
@@ -233,8 +231,6 @@ class StringArray(BaseStringArray, PandasArray):
233231
"""
234232
Extension array for string data.
235233
236-
.. versionadded:: 1.0.0
237-
238234
.. warning::
239235
240236
StringArray is considered experimental. The implementation and

pandas/core/base.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -496,15 +496,10 @@ def to_numpy(
496496
na_value : Any, optional
497497
The value to use for missing values. The default value depends
498498
on `dtype` and the type of the array.
499-
500-
.. versionadded:: 1.0.0
501-
502499
**kwargs
503500
Additional keywords passed through to the ``to_numpy`` method
504501
of the underlying array (for extension arrays).
505502
506-
.. versionadded:: 1.0.0
507-
508503
Returns
509504
-------
510505
numpy.ndarray

pandas/core/construction.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,6 @@ def array(
128128
129129
For all other cases, NumPy's usual inference rules will be used.
130130
131-
.. versionchanged:: 1.0.0
132-
133-
Pandas infers nullable-integer dtype for integer data,
134-
string dtype for string data, and nullable-boolean dtype
135-
for boolean data.
136-
137131
.. versionchanged:: 1.2.0
138132
139133
Pandas now also infers nullable-floating dtype for float-like

0 commit comments

Comments
 (0)