Skip to content

Commit 40dfd1e

Browse files
Merge remote-tracking branch 'upstream/main' into bisect
2 parents fe0d3e8 + 4791cd7 commit 40dfd1e

File tree

151 files changed

+2958
-1379
lines changed

Some content is hidden

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

151 files changed

+2958
-1379
lines changed

.github/workflows/32-bit-linux.yml

+6
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@ jobs:
2323

2424
- name: Run 32-bit manylinux2014 Docker Build / Tests
2525
run: |
26+
# Without this (line 34), versioneer will not be able to determine the pandas version.
27+
# This is because of a security update to git that blocks it from reading the config folder if
28+
# it is not owned by the current user. We hit this since the "mounted" folder is not hit by the
29+
# Docker container.
30+
# xref https://github.com/pypa/manylinux/issues/1309
2631
docker pull quay.io/pypa/manylinux2014_i686
2732
docker run --platform linux/386 -v $(pwd):/pandas quay.io/pypa/manylinux2014_i686 \
2833
/bin/bash -xc "cd pandas && \
34+
git config --global --add safe.directory /pandas && \
2935
/opt/python/cp38-cp38/bin/python -m venv ~/virtualenvs/pandas-dev && \
3036
. ~/virtualenvs/pandas-dev/bin/activate && \
3137
python -m pip install --no-deps -U pip wheel 'setuptools<60.0.0' && \

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repos:
1111
- id: absolufy-imports
1212
files: ^pandas/
1313
- repo: https://github.com/jendrikseipp/vulture
14-
rev: 'v2.3'
14+
rev: 'v2.4'
1515
hooks:
1616
- id: vulture
1717
entry: python scripts/run_vulture.py
@@ -60,7 +60,7 @@ repos:
6060
hooks:
6161
- id: isort
6262
- repo: https://github.com/asottile/pyupgrade
63-
rev: v2.32.0
63+
rev: v2.32.1
6464
hooks:
6565
- id: pyupgrade
6666
args: [--py38-plus]
@@ -75,7 +75,7 @@ repos:
7575
types: [text] # overwrite types: [rst]
7676
types_or: [python, rst]
7777
- repo: https://github.com/sphinx-contrib/sphinx-lint
78-
rev: v0.4.1
78+
rev: v0.6
7979
hooks:
8080
- id: sphinx-lint
8181
- repo: https://github.com/asottile/yesqa

asv_bench/benchmarks/reshape.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ def setup(self, bins):
268268
self.datetime_series = pd.Series(
269269
np.random.randint(N, size=N), dtype="datetime64[ns]"
270270
)
271-
self.interval_bins = pd.IntervalIndex.from_breaks(np.linspace(0, N, bins))
271+
self.interval_bins = pd.IntervalIndex.from_breaks(
272+
np.linspace(0, N, bins), "right"
273+
)
272274

273275
def time_cut_int(self, bins):
274276
pd.cut(self.int_series, bins)

ci/deps/actions-310.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies:
55
- python=3.10
66

77
# test dependencies
8-
- cython=0.29.24
8+
- cython=0.29.30
99
- pytest>=6.0
1010
- pytest-cov
1111
- pytest-xdist>=1.31

ci/deps/actions-38-downstream_compat.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
- python=3.8
77

88
# test dependencies
9-
- cython=0.29.24
9+
- cython=0.29.30
1010
- pytest>=6.0
1111
- pytest-cov
1212
- pytest-xdist>=1.31

ci/deps/actions-38-minimum_versions.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77
- python=3.8.0
88

99
# test dependencies
10-
- cython=0.29.24
10+
- cython=0.29.30
1111
- pytest>=6.0
1212
- pytest-cov
1313
- pytest-xdist>=1.31

ci/deps/actions-38.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies:
55
- python=3.8
66

77
# test dependencies
8-
- cython=0.29.24
8+
- cython=0.29.30
99
- pytest>=6.0
1010
- pytest-cov
1111
- pytest-xdist>=1.31

ci/deps/actions-39.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies:
55
- python=3.9
66

77
# test dependencies
8-
- cython=0.29.24
8+
- cython=0.29.30
99
- pytest>=6.0
1010
- pytest-cov
1111
- pytest-xdist>=1.31

ci/deps/actions-pypy-38.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies:
88
- python=3.8[build=*_pypy] # TODO: use this once pypy3.8 is available
99

1010
# tools
11-
- cython>=0.29.24
11+
- cython>=0.29.30
1212
- pytest>=6.0
1313
- pytest-cov
1414
- pytest-asyncio

ci/deps/circle-38-arm64.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies:
55
- python=3.8
66

77
# test dependencies
8-
- cython=0.29.24
8+
- cython=0.29.30
99
- pytest>=6.0
1010
- pytest-cov
1111
- pytest-xdist>=1.31

doc/redirects.csv

+2-2
Original file line numberDiff line numberDiff line change
@@ -741,11 +741,11 @@ generated/pandas.Index.values,../reference/api/pandas.Index.values
741741
generated/pandas.Index.view,../reference/api/pandas.Index.view
742742
generated/pandas.Index.where,../reference/api/pandas.Index.where
743743
generated/pandas.infer_freq,../reference/api/pandas.infer_freq
744-
generated/pandas.Interval.closed,../reference/api/pandas.Interval.closed
744+
generated/pandas.Interval.inclusive,../reference/api/pandas.Interval.inclusive
745745
generated/pandas.Interval.closed_left,../reference/api/pandas.Interval.closed_left
746746
generated/pandas.Interval.closed_right,../reference/api/pandas.Interval.closed_right
747747
generated/pandas.Interval,../reference/api/pandas.Interval
748-
generated/pandas.IntervalIndex.closed,../reference/api/pandas.IntervalIndex.closed
748+
generated/pandas.IntervalIndex.inclusive,../reference/api/pandas.IntervalIndex.inclusive
749749
generated/pandas.IntervalIndex.contains,../reference/api/pandas.IntervalIndex.contains
750750
generated/pandas.IntervalIndex.from_arrays,../reference/api/pandas.IntervalIndex.from_arrays
751751
generated/pandas.IntervalIndex.from_breaks,../reference/api/pandas.IntervalIndex.from_breaks

doc/source/reference/arrays.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ Properties
303303
.. autosummary::
304304
:toctree: api/
305305

306-
Interval.closed
306+
Interval.inclusive
307307
Interval.closed_left
308308
Interval.closed_right
309309
Interval.is_empty
@@ -340,7 +340,7 @@ A collection of intervals may be stored in an :class:`arrays.IntervalArray`.
340340
341341
arrays.IntervalArray.left
342342
arrays.IntervalArray.right
343-
arrays.IntervalArray.closed
343+
arrays.IntervalArray.inclusive
344344
arrays.IntervalArray.mid
345345
arrays.IntervalArray.length
346346
arrays.IntervalArray.is_empty

doc/source/reference/indexing.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ IntervalIndex components
242242
IntervalIndex.left
243243
IntervalIndex.right
244244
IntervalIndex.mid
245-
IntervalIndex.closed
245+
IntervalIndex.inclusive
246246
IntervalIndex.length
247247
IntervalIndex.values
248248
IntervalIndex.is_empty

doc/source/reference/testing.rst

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Exceptions and warnings
4141
errors.ParserError
4242
errors.ParserWarning
4343
errors.PerformanceWarning
44+
errors.SettingWithCopyError
4445
errors.SpecificationError
4546
errors.UnsortedIndexError
4647
errors.UnsupportedFunctionCall

doc/source/user_guide/advanced.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ Trying to select an ``Interval`` that is not exactly contained in the ``Interval
10201020
10211021
In [7]: df.loc[pd.Interval(0.5, 2.5)]
10221022
---------------------------------------------------------------------------
1023-
KeyError: Interval(0.5, 2.5, closed='right')
1023+
KeyError: Interval(0.5, 2.5, inclusive='right')
10241024
10251025
Selecting all ``Intervals`` that overlap a given ``Interval`` can be performed using the
10261026
:meth:`~IntervalIndex.overlaps` method to create a boolean indexer.

doc/source/user_guide/indexing.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1885,7 +1885,7 @@ chained indexing expression, you can set the :ref:`option <options>`
18851885
``mode.chained_assignment`` to one of these values:
18861886

18871887
* ``'warn'``, the default, means a ``SettingWithCopyWarning`` is printed.
1888-
* ``'raise'`` means pandas will raise a ``SettingWithCopyException``
1888+
* ``'raise'`` means pandas will raise a ``SettingWithCopyError``
18891889
you have to deal with.
18901890
* ``None`` will suppress the warnings entirely.
18911891

@@ -1953,7 +1953,7 @@ Last, the subsequent example will **not** work at all, and so should be avoided:
19531953
>>> dfd.loc[0]['a'] = 1111
19541954
Traceback (most recent call last)
19551955
...
1956-
SettingWithCopyException:
1956+
SettingWithCopyError:
19571957
A value is trying to be set on a copy of a slice from a DataFrame.
19581958
Try using .loc[row_index,col_indexer] = value instead
19591959

doc/source/whatsnew/v0.20.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ Selecting via a specific interval:
448448

449449
.. ipython:: python
450450
451-
df.loc[pd.Interval(1.5, 3.0)]
451+
df.loc[pd.Interval(1.5, 3.0, "right")]
452452
453453
Selecting via a scalar value that is contained *in* the intervals.
454454

doc/source/whatsnew/v0.25.0.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -584,18 +584,18 @@ this would previously return ``True`` for any ``Interval`` overlapping an ``Inte
584584

585585
.. code-block:: python
586586
587-
In [4]: pd.Interval(1, 2, closed='neither') in ii
587+
In [4]: pd.Interval(1, 2, inclusive='neither') in ii
588588
Out[4]: True
589589
590-
In [5]: pd.Interval(-10, 10, closed='both') in ii
590+
In [5]: pd.Interval(-10, 10, inclusive='both') in ii
591591
Out[5]: True
592592
593593
*New behavior*:
594594

595595
.. ipython:: python
596596
597-
pd.Interval(1, 2, closed='neither') in ii
598-
pd.Interval(-10, 10, closed='both') in ii
597+
pd.Interval(1, 2, inclusive='neither') in ii
598+
pd.Interval(-10, 10, inclusive='both') in ii
599599
600600
The :meth:`~IntervalIndex.get_loc` method now only returns locations for exact matches to ``Interval`` queries, as opposed to the previous behavior of
601601
returning locations for overlapping matches. A ``KeyError`` will be raised if an exact match is not found.
@@ -619,7 +619,7 @@ returning locations for overlapping matches. A ``KeyError`` will be raised if a
619619
620620
In [7]: ii.get_loc(pd.Interval(2, 6))
621621
---------------------------------------------------------------------------
622-
KeyError: Interval(2, 6, closed='right')
622+
KeyError: Interval(2, 6, inclusive='right')
623623
624624
Likewise, :meth:`~IntervalIndex.get_indexer` and :meth:`~IntervalIndex.get_indexer_non_unique` will also only return locations for exact matches
625625
to ``Interval`` queries, with ``-1`` denoting that an exact match was not found.
@@ -680,11 +680,11 @@ Similarly, a ``KeyError`` will be raised for non-exact matches instead of return
680680
681681
In [6]: s[pd.Interval(2, 3)]
682682
---------------------------------------------------------------------------
683-
KeyError: Interval(2, 3, closed='right')
683+
KeyError: Interval(2, 3, inclusive='right')
684684
685685
In [7]: s.loc[pd.Interval(2, 3)]
686686
---------------------------------------------------------------------------
687-
KeyError: Interval(2, 3, closed='right')
687+
KeyError: Interval(2, 3, inclusive='right')
688688
689689
The :meth:`~IntervalIndex.overlaps` method can be used to create a boolean indexer that replicates the
690690
previous behavior of returning overlapping matches.

doc/source/whatsnew/v1.4.3.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@ Fixed regressions
1919
- Fixed regression in :func:`read_fwf` raising ``ValueError`` when ``widths`` was specified with ``usecols`` (:issue:`46580`)
2020
- Fixed regression in :meth:`.Groupby.transform` and :meth:`.Groupby.agg` failing with ``engine="numba"`` when the index was a :class:`MultiIndex` (:issue:`46867`)
2121
- Fixed regression is :meth:`.Styler.to_latex` and :meth:`.Styler.to_html` where ``buf`` failed in combination with ``encoding`` (:issue:`47053`)
22+
- Fixed regression in :func:`read_csv` with ``index_col=False`` identifying first row as index names when ``header=None`` (:issue:`46955`)
2223
- Fixed regression in :meth:`.DataFrameGroupBy.agg` when used with list-likes or dict-likes and ``axis=1`` that would give incorrect results; now raises ``NotImplementedError`` (:issue:`46995`)
2324
- Fixed regression in :meth:`DataFrame.resample` and :meth:`DataFrame.rolling` when used with list-likes or dict-likes and ``axis=1`` that would raise an unintuitive error message; now raises ``NotImplementedError`` (:issue:`46904`)
25+
- Fixed regression in :meth:`DataFrame.shift` when ``axis`` is ``columns`` and ``fill_value`` is absent, ``freq`` is ignored (:issue:`47039`)
2426

2527
.. ---------------------------------------------------------------------------
2628
2729
.. _whatsnew_143.bug_fixes:
2830

2931
Bug fixes
3032
~~~~~~~~~
31-
-
33+
- Most I/O methods do no longer suppress ``OSError`` and ``ValueError`` when closing file handles (:issue:`47136`)
3234
-
3335

3436
.. ---------------------------------------------------------------------------
@@ -37,7 +39,7 @@ Bug fixes
3739

3840
Other
3941
~~~~~
40-
-
42+
- The minimum version of Cython needed to compile pandas is now ``0.29.30`` (:issue:`41935`)
4143
-
4244

4345
.. ---------------------------------------------------------------------------

doc/source/whatsnew/v1.5.0.rst

+12-5
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Other enhancements
151151
- A :class:`errors.PerformanceWarning` is now thrown when using ``string[pyarrow]`` dtype with methods that don't dispatch to ``pyarrow.compute`` methods (:issue:`42613`)
152152
- Added ``numeric_only`` argument to :meth:`Resampler.sum`, :meth:`Resampler.prod`, :meth:`Resampler.min`, :meth:`Resampler.max`, :meth:`Resampler.first`, and :meth:`Resampler.last` (:issue:`46442`)
153153
- ``times`` argument in :class:`.ExponentialMovingWindow` now accepts ``np.timedelta64`` (:issue:`47003`)
154-
- :class:`DataError` and :class:`SpecificationError` are now exposed in ``pandas.errors`` (:issue:`27656`)
154+
- :class:`DataError`, :class:`SpecificationError`, and :class:`SettingWithCopyError` are now exposed in ``pandas.errors`` (:issue:`27656`)
155155

156156
.. ---------------------------------------------------------------------------
157157
.. _whatsnew_150.notable_bug_fixes:
@@ -362,7 +362,7 @@ If installed, we now require:
362362
+-----------------+-----------------+----------+---------+
363363
| Package | Minimum Version | Required | Changed |
364364
+=================+=================+==========+=========+
365-
| mypy (dev) | 0.950 | | X |
365+
| mypy (dev) | 0.960 | | X |
366366
+-----------------+-----------------+----------+---------+
367367
| beautifulsoup4 | 4.9.3 | | X |
368368
+-----------------+-----------------+----------+---------+
@@ -669,7 +669,12 @@ Other Deprecations
669669
- Deprecated the methods :meth:`DataFrame.mad`, :meth:`Series.mad`, and the corresponding groupby methods (:issue:`11787`)
670670
- Deprecated positional arguments to :meth:`Index.join` except for ``other``, use keyword-only arguments instead of positional arguments (:issue:`46518`)
671671
- Deprecated indexing on a timezone-naive :class:`DatetimeIndex` using a string representing a timezone-aware datetime (:issue:`46903`, :issue:`36148`)
672-
-
672+
- Deprecated the ``closed`` argument in :class:`Interval` in favor of ``inclusive`` argument; In a future version passing ``closed`` will raise (:issue:`40245`)
673+
- Deprecated the ``closed`` argument in :class:`IntervalIndex` in favor of ``inclusive`` argument; In a future version passing ``closed`` will raise (:issue:`40245`)
674+
- Deprecated the ``closed`` argument in :class:`IntervalDtype` in favor of ``inclusive`` argument; In a future version passing ``closed`` will raise (:issue:`40245`)
675+
- Deprecated the ``closed`` argument in :class:`IntervalArray` in favor of ``inclusive`` argument; In a future version passing ``closed`` will raise (:issue:`40245`)
676+
- Deprecated the ``closed`` argument in :class:`intervaltree` in favor of ``inclusive`` argument; In a future version passing ``closed`` will raise (:issue:`40245`)
677+
- Deprecated the ``closed`` argument in :class:`ArrowInterval` in favor of ``inclusive`` argument; In a future version passing ``closed`` will raise (:issue:`40245`)
673678

674679
.. ---------------------------------------------------------------------------
675680
.. _whatsnew_150.performance:
@@ -780,7 +785,7 @@ Indexing
780785
- Bug in setting large integer values into :class:`Series` with ``float32`` or ``float16`` dtype incorrectly altering these values instead of coercing to ``float64`` dtype (:issue:`45844`)
781786
- Bug in :meth:`Series.asof` and :meth:`DataFrame.asof` incorrectly casting bool-dtype results to ``float64`` dtype (:issue:`16063`)
782787
- Bug in :meth:`NDFrame.xs`, :meth:`DataFrame.iterrows`, :meth:`DataFrame.loc` and :meth:`DataFrame.iloc` not always propagating metadata (:issue:`28283`)
783-
-
788+
- Bug in :meth:`DataFrame.sum` min_count changes dtype if input contains NaNs (:issue:`46947`)
784789

785790
Missing
786791
^^^^^^^
@@ -809,10 +814,12 @@ I/O
809814
- Bug in :func:`read_parquet` when ``engine="pyarrow"`` which caused partial write to disk when column of unsupported datatype was passed (:issue:`44914`)
810815
- Bug in :func:`DataFrame.to_excel` and :class:`ExcelWriter` would raise when writing an empty DataFrame to a ``.ods`` file (:issue:`45793`)
811816
- Bug in :func:`read_html` where elements surrounding ``<br>`` were joined without a space between them (:issue:`29528`)
817+
- Bug in :func:`read_csv` when data is longer than header leading to issues with callables in ``usecols`` expecting strings (:issue:`46997`)
812818
- Bug in Parquet roundtrip for Interval dtype with ``datetime64[ns]`` subtype (:issue:`45881`)
813819
- Bug in :func:`read_excel` when reading a ``.ods`` file with newlines between xml elements (:issue:`45598`)
814820
- Bug in :func:`read_parquet` when ``engine="fastparquet"`` where the file was not closed on error (:issue:`46555`)
815821
- :meth:`to_html` now excludes the ``border`` attribute from ``<table>`` elements when ``border`` keyword is set to ``False``.
822+
- Bug in :func:`read_sas` returned ``None`` rather than an empty DataFrame for SAS7BDAT files with zero rows (:issue:`18198`)
816823
-
817824

818825
Period
@@ -855,7 +862,7 @@ Groupby/resample/rolling
855862
- Bug in :meth:`Grouper.__repr__` where ``dropna`` was not included. Now it is (:issue:`46754`)
856863
- Bug in :meth:`DataFrame.rolling` gives ValueError when center=True, axis=1 and win_type is specified (:issue:`46135`)
857864
- Bug in :meth:`.DataFrameGroupBy.describe` and :meth:`.SeriesGroupBy.describe` produces inconsistent results for empty datasets (:issue:`41575`)
858-
-
865+
- Bug in :meth:`DataFrame.resample` reduction methods when used with ``on`` would attempt to aggregate the provided column (:issue:`47079`)
859866

860867
Reshaping
861868
^^^^^^^^^

environment.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies:
1515
# The compiler packages are meta-packages and install the correct compiler (activation) packages on the respective platforms.
1616
- c-compiler
1717
- cxx-compiler
18-
- cython>=0.29.24
18+
- cython>=0.29.30
1919

2020
# code checks
2121
- black=22.3.0
@@ -24,7 +24,7 @@ dependencies:
2424
- flake8-bugbear=21.3.2 # used by flake8, find likely bugs
2525
- flake8-comprehensions=3.7.0 # used by flake8, linting of unnecessary comprehensions
2626
- isort>=5.2.1 # check that imports are in the right order
27-
- mypy=0.950
27+
- mypy=0.960
2828
- pre-commit>=2.15.0
2929
- pycodestyle # used by flake8
3030
- pyupgrade

0 commit comments

Comments
 (0)