Skip to content

Commit 2caa671

Browse files
committed
Merge branch 'main' of https://github.com/pandas-dev/pandas into factorize_na_v2
� Conflicts: � pandas/core/arrays/_mixins.py
2 parents 565fb17 + 7dd22b8 commit 2caa671

File tree

174 files changed

+2860
-2068
lines changed

Some content is hidden

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

174 files changed

+2860
-2068
lines changed

.github/workflows/code-checks.yml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -140,22 +140,8 @@ jobs:
140140
- name: Run ASV benchmarks
141141
run: |
142142
cd asv_bench
143-
asv check -E existing
144-
git remote add upstream https://github.com/pandas-dev/pandas.git
145-
git fetch upstream
146143
asv machine --yes
147-
asv dev | sed "/failed$/ s/^/##[error]/" | tee benchmarks.log
148-
if grep "failed" benchmarks.log > /dev/null ; then
149-
exit 1
150-
fi
151-
if: ${{ steps.build.outcome == 'success' }}
152-
153-
- name: Publish benchmarks artifact
154-
uses: actions/upload-artifact@v3
155-
with:
156-
name: Benchmarks log
157-
path: asv_bench/benchmarks.log
158-
if: failure()
144+
asv run --quick --dry-run --strict --durations=30 --python=same
159145
160146
build_docker_dev_environment:
161147
name: Build Docker Dev Environment

.github/workflows/posix.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
env_file: actions-310-numpydev.yaml
6262
pattern: "not slow and not network and not single_cpu"
6363
pandas_testing_mode: "deprecate"
64-
test_args: "-W error"
64+
test_args: "-W error::DeprecationWarning:numpy"
6565
fail-fast: false
6666
name: ${{ matrix.name || format('{0} pyarrow={1} {2}', matrix.env_file, matrix.pyarrow_version, matrix.pattern) }}
6767
env:
@@ -174,7 +174,7 @@ jobs:
174174
if: always()
175175

176176
- name: Build Version
177-
run: pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd
177+
run: conda list
178178

179179
- name: Publish test results
180180
uses: actions/upload-artifact@v3

.pre-commit-config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ repos:
7070
- id: rst-inline-touching-normal
7171
types: [text] # overwrite types: [rst]
7272
types_or: [python, rst]
73+
- repo: https://github.com/sphinx-contrib/sphinx-lint
74+
rev: v0.2
75+
hooks:
76+
- id: sphinx-lint
7377
- repo: https://github.com/asottile/yesqa
7478
rev: v1.3.0
7579
hooks:
@@ -172,6 +176,13 @@ repos:
172176
files: ^pandas/core/
173177
exclude: ^pandas/core/api\.py$
174178
types: [python]
179+
- id: use-io-common-urlopen
180+
name: Use pandas.io.common.urlopen instead of urllib.request.urlopen
181+
language: python
182+
entry: python scripts/use_io_common_urlopen.py
183+
files: ^pandas/
184+
exclude: ^pandas/tests/
185+
types: [python]
175186
- id: no-bool-in-core-generic
176187
name: Use bool_t instead of bool in pandas/core/generic.py
177188
entry: python scripts/no_bool_in_generic.py

LICENSES/KLIB_LICENSE

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
The MIT License
2+
3+
Copyright (c) 2008- Attractive Chaos <attractor@live.co.uk>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the
7+
"Software"), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following conditions:
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21+
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
SOFTWARE.

LICENSES/OTHER

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
numpydoc license
2-
----------------
3-
4-
The numpydoc license is in pandas/doc/sphinxext/LICENSE.txt
5-
61
Bottleneck license
72
------------------
83

@@ -77,4 +72,4 @@ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
7772
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
7873
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
7974
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
80-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
75+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

MANIFEST.in

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
include RELEASE.md
2+
include versioneer.py
23

34
graft doc
45
prune doc/build
@@ -54,9 +55,6 @@ global-exclude *.pxi
5455
# exclude the whole directory to avoid running related tests in sdist
5556
prune pandas/tests/io/parser/data
5657

57-
include versioneer.py
58-
include pandas/_version.py
59-
include pandas/io/formats/templates/*.tpl
60-
58+
# Selectively re-add *.cxx files that were excluded above
6159
graft pandas/_libs/src
6260
graft pandas/_libs/tslibs/src

ci/code_checks.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ fi
7878
### DOCSTRINGS ###
7979
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
8080

81-
MSG='Validate docstrings (EX04, GL01, GL02, GL03, GL04, GL05, GL06, GL07, GL09, GL10, PR03, PR04, PR05, PR06, PR08, PR09, PR10, RT01, RT04, RT05, SA02, SA03, SS01, SS02, SS03, SS04, SS05)' ; echo $MSG
82-
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX04,GL01,GL02,GL03,GL04,GL05,GL06,GL07,GL09,GL10,PR03,PR04,PR05,PR06,PR08,PR09,PR10,RT01,RT04,RT05,SA02,SA03,SS01,SS02,SS03,SS04,SS05
81+
MSG='Validate docstrings (EX04, GL01, GL02, GL03, GL04, GL05, GL06, GL07, GL09, GL10, PR03, PR04, PR05, PR06, PR08, PR09, PR10, RT01, RT04, RT05, SA02, SA03, SA04, SS01, SS02, SS03, SS04, SS05)' ; echo $MSG
82+
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX04,GL01,GL02,GL03,GL04,GL05,GL06,GL07,GL09,GL10,PR03,PR04,PR05,PR06,PR08,PR09,PR10,RT01,RT04,RT05,SA02,SA03,SA04,SS01,SS02,SS03,SS04,SS05
8383
RET=$(($RET + $?)) ; echo $MSG "DONE"
8484

8585
fi

ci/deps/actions-310.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ dependencies:
99
- pytest>=6.0
1010
- pytest-cov
1111
- pytest-xdist>=1.31
12-
- hypothesis>=5.5.3
1312
- psutil
1413
- pytest-asyncio>=0.17
1514
- boto3
@@ -27,6 +26,7 @@ dependencies:
2726
- fastparquet
2827
- fsspec
2928
- html5lib
29+
- hypothesis
3030
- gcsfs
3131
- jinja2
3232
- lxml

ci/deps/actions-38-downstream_compat.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ dependencies:
1010
- pytest>=6.0
1111
- pytest-cov
1212
- pytest-xdist>=1.31
13-
- hypothesis>=5.5.3
1413
- psutil
1514
- pytest-asyncio>=0.17
1615
- boto3
@@ -28,6 +27,7 @@ dependencies:
2827
- fastparquet
2928
- fsspec
3029
- html5lib
30+
- hypothesis
3131
- gcsfs
3232
- jinja2
3333
- lxml
@@ -60,7 +60,7 @@ dependencies:
6060
- cftime
6161
- dask
6262
- ipython
63-
- geopandas
63+
- geopandas-base
6464
- seaborn
6565
- scikit-learn
6666
- statsmodels

ci/deps/actions-38-minimum_versions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ dependencies:
1111
- pytest>=6.0
1212
- pytest-cov
1313
- pytest-xdist>=1.31
14-
- hypothesis>=5.5.3
1514
- psutil
1615
- pytest-asyncio>=0.17
1716
- boto3
@@ -29,6 +28,7 @@ dependencies:
2928
- fastparquet=0.4.0
3029
- fsspec=0.7.4
3130
- html5lib=1.1
31+
- hypothesis=5.5.3
3232
- gcsfs=0.6.0
3333
- jinja2=2.11
3434
- lxml=4.5.0

ci/deps/actions-38.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ dependencies:
99
- pytest>=6.0
1010
- pytest-cov
1111
- pytest-xdist>=1.31
12-
- hypothesis>=5.5.3
1312
- psutil
1413
- pytest-asyncio>=0.17
1514
- boto3
@@ -27,6 +26,7 @@ dependencies:
2726
- fastparquet
2827
- fsspec
2928
- html5lib
29+
- hypothesis
3030
- gcsfs
3131
- jinja2
3232
- lxml

ci/deps/actions-39.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ dependencies:
99
- pytest>=6.0
1010
- pytest-cov
1111
- pytest-xdist>=1.31
12-
- hypothesis>=5.5.3
1312
- psutil
1413
- pytest-asyncio>=0.17
1514
- boto3
@@ -27,6 +26,7 @@ dependencies:
2726
- fastparquet
2827
- fsspec
2928
- html5lib
29+
- hypothesis
3030
- gcsfs
3131
- jinja2
3232
- lxml

ci/deps/circle-38-arm64.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ dependencies:
99
- pytest>=6.0
1010
- pytest-cov
1111
- pytest-xdist>=1.31
12-
- hypothesis>=5.5.3
1312
- psutil
1413
- pytest-asyncio>=0.17
1514
- boto3
@@ -27,6 +26,7 @@ dependencies:
2726
- fastparquet
2827
- fsspec
2928
- html5lib
29+
- hypothesis
3030
- gcsfs
3131
- jinja2
3232
- lxml

doc/source/development/code_style.rst

Lines changed: 0 additions & 31 deletions
This file was deleted.

doc/source/development/contributing_codebase.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,14 @@ In addition to ``./ci/code_checks.sh``, some extra checks are run by
3737
``pre-commit`` - see :ref:`here <contributing.pre-commit>` for how to
3838
run them.
3939

40-
Additional standards are outlined on the :ref:`pandas code style guide <code_style>`.
41-
4240
.. _contributing.pre-commit:
4341

4442
Pre-commit
4543
----------
4644

4745
Additionally, :ref:`Continuous Integration <contributing.ci>` will run code formatting checks
48-
like ``black``, ``flake8``, ``isort``, and ``cpplint`` and more using `pre-commit hooks <https://pre-commit.com/>`_
46+
like ``black``, ``flake8`` (including a `pandas-dev-flaker <https://github.com/pandas-dev/pandas-dev-flaker>`_ plugin),
47+
``isort``, and ``cpplint`` and more using `pre-commit hooks <https://pre-commit.com/>`_
4948
Any warnings from these checks will cause the :ref:`Continuous Integration <contributing.ci>` to fail; therefore,
5049
it is helpful to run the check yourself before submitting code. This
5150
can be done by installing ``pre-commit``::
@@ -223,7 +222,7 @@ In some cases you may be tempted to use ``cast`` from the typing module when you
223222
...
224223
else: # Reasonably only str objects would reach this but...
225224
obj = cast(str, obj) # Mypy complains without this!
226-
return obj.upper()
225+
return obj.upper()
227226
228227
The limitation here is that while a human can reasonably understand that ``is_number`` would catch the ``int`` and ``float`` types mypy cannot make that same inference just yet (see `mypy #5206 <https://github.com/python/mypy/issues/5206>`_. While the above works, the use of ``cast`` is **strongly discouraged**. Where applicable a refactor of the code to appease static analysis is preferable
229228

doc/source/development/contributing_environment.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ You will need `Build Tools for Visual Studio 2019
8585
<https://visualstudio.microsoft.com/downloads/>`_.
8686

8787
.. warning::
88-
You DO NOT need to install Visual Studio 2019.
89-
You only need "Build Tools for Visual Studio 2019" found by
90-
scrolling down to "All downloads" -> "Tools for Visual Studio 2019".
91-
In the installer, select the "C++ build tools" workload.
88+
You DO NOT need to install Visual Studio 2019.
89+
You only need "Build Tools for Visual Studio 2019" found by
90+
scrolling down to "All downloads" -> "Tools for Visual Studio 2019".
91+
In the installer, select the "C++ build tools" workload.
9292

9393
You can install the necessary components on the commandline using
9494
`vs_buildtools.exe <https://download.visualstudio.microsoft.com/download/pr/9a26f37e-6001-429b-a5db-c5455b93953c/460d80ab276046de2455a4115cc4e2f1e6529c9e6cb99501844ecafd16c619c4/vs_BuildTools.exe>`_:

doc/source/development/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Development
1616
contributing_environment
1717
contributing_documentation
1818
contributing_codebase
19-
code_style
2019
maintaining
2120
internals
2221
test_writing

doc/source/ecosystem.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,15 +540,15 @@ Pandas-Genomics provides extension types, extension arrays, and extension access
540540
`Pint-Pandas`_
541541
~~~~~~~~~~~~~~
542542

543-
``Pint-Pandas <https://github.com/hgrecco/pint-pandas>`` provides an extension type for
543+
`Pint-Pandas <https://github.com/hgrecco/pint-pandas>`_ provides an extension type for
544544
storing numeric arrays with units. These arrays can be stored inside pandas'
545545
Series and DataFrame. Operations between Series and DataFrame columns which
546546
use pint's extension array are then units aware.
547547

548548
`Text Extensions for Pandas`_
549549
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
550550

551-
``Text Extensions for Pandas <https://ibm.biz/text-extensions-for-pandas>``
551+
`Text Extensions for Pandas <https://ibm.biz/text-extensions-for-pandas>`_
552552
provides extension types to cover common data structures for representing natural language
553553
data, plus library integrations that convert the outputs of popular natural language
554554
processing libraries into Pandas DataFrames.

doc/source/reference/groupby.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,7 @@ The following methods are available only for ``SeriesGroupBy`` objects.
132132
SeriesGroupBy.hist
133133
SeriesGroupBy.nlargest
134134
SeriesGroupBy.nsmallest
135-
SeriesGroupBy.nunique
136135
SeriesGroupBy.unique
137-
SeriesGroupBy.value_counts
138136
SeriesGroupBy.is_monotonic_increasing
139137
SeriesGroupBy.is_monotonic_decreasing
140138

doc/source/reference/series.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ Datetime methods
342342
:toctree: api/
343343
:template: autosummary/accessor_method.rst
344344

345+
Series.dt.isocalendar
345346
Series.dt.to_period
346347
Series.dt.to_pydatetime
347348
Series.dt.tz_localize

doc/source/user_guide/advanced.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,14 +1082,14 @@ of :ref:`frequency aliases <timeseries.offset_aliases>` with datetime-like inter
10821082
10831083
pd.interval_range(start=pd.Timedelta("0 days"), periods=3, freq="9H")
10841084
1085-
Additionally, the ``closed`` parameter can be used to specify which side(s) the intervals
1086-
are closed on. Intervals are closed on the right side by default.
1085+
Additionally, the ``inclusive`` parameter can be used to specify which side(s) the intervals
1086+
are closed on. Intervals are closed on the both side by default.
10871087

10881088
.. ipython:: python
10891089
1090-
pd.interval_range(start=0, end=4, closed="both")
1090+
pd.interval_range(start=0, end=4, inclusive="both")
10911091
1092-
pd.interval_range(start=0, end=4, closed="neither")
1092+
pd.interval_range(start=0, end=4, inclusive="neither")
10931093
10941094
Specifying ``start``, ``end``, and ``periods`` will generate a range of evenly spaced
10951095
intervals from ``start`` to ``end`` inclusively, with ``periods`` number of elements

doc/source/user_guide/cookbook.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ Fill forward a reversed timeseries
423423
)
424424
df.loc[df.index[3], "A"] = np.nan
425425
df
426-
df.reindex(df.index[::-1]).ffill()
426+
df.bfill()
427427
428428
`cumsum reset at NaN values
429429
<https://stackoverflow.com/questions/18196811/cumsum-reset-at-nan>`__

doc/source/user_guide/dsintro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ Boolean operators operate element-wise as well:
678678
Transposing
679679
~~~~~~~~~~~
680680

681-
To transpose, access the ``T`` attribute or :meth:`DataFrame.transpose``,
681+
To transpose, access the ``T`` attribute or :meth:`DataFrame.transpose`,
682682
similar to an ndarray:
683683

684684
.. ipython:: python

0 commit comments

Comments
 (0)