Skip to content

Commit 58f97c7

Browse files
Merge remote-tracking branch 'upstream/main' into bisect
2 parents 00918df + 8bc0832 commit 58f97c7

File tree

166 files changed

+5294
-1728
lines changed

Some content is hidden

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

166 files changed

+5294
-1728
lines changed

.github/workflows/code-checks.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ jobs:
8080
id: build
8181
uses: ./.github/actions/build_pandas
8282

83+
- name: Check for no warnings when building single-page docs
84+
run: ci/code_checks.sh single-docs
85+
if: ${{ steps.build.outcome == 'success' }}
86+
8387
- name: Run checks on imported code
8488
run: ci/code_checks.sh code
8589
if: ${{ steps.build.outcome == 'success' }}

.github/workflows/docbuild-and-upload.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
run: |
3838
source activate pandas-dev
3939
python web/pandas_web.py web/pandas --target-path=web/build
40+
4041
- name: Build documentation
4142
run: |
4243
source activate pandas-dev

.github/workflows/posix.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
pattern: ["not single_cpu", "single_cpu"]
2929
# Don't test pyarrow v2/3: Causes timeouts in read_csv engine
3030
# even if tests are skipped/xfailed
31-
pyarrow_version: ["5", "7"]
31+
pyarrow_version: ["5", "6", "7"]
3232
include:
3333
- name: "Downstream Compat"
3434
env_file: actions-38-downstream_compat.yaml
@@ -62,6 +62,15 @@ jobs:
6262
pattern: "not slow and not network and not single_cpu"
6363
pandas_testing_mode: "deprecate"
6464
test_args: "-W error::DeprecationWarning:numpy"
65+
exclude:
66+
- env_file: actions-39.yaml
67+
pyarrow_version: "6"
68+
- env_file: actions-39.yaml
69+
pyarrow_version: "7"
70+
- env_file: actions-310.yaml
71+
pyarrow_version: "6"
72+
- env_file: actions-310.yaml
73+
pyarrow_version: "7"
6574
fail-fast: false
6675
name: ${{ matrix.name || format('{0} pyarrow={1} {2}', matrix.env_file, matrix.pyarrow_version, matrix.pattern) }}
6776
env:

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ repos:
2626
types_or: [python, rst, markdown]
2727
files: ^(pandas|doc)/
2828
- repo: https://github.com/pre-commit/pre-commit-hooks
29-
rev: v4.1.0
29+
rev: v4.2.0
3030
hooks:
3131
- id: debug-statements
3232
- id: end-of-file-fixer
@@ -56,7 +56,7 @@ repos:
5656
hooks:
5757
- id: isort
5858
- repo: https://github.com/asottile/pyupgrade
59-
rev: v2.31.1
59+
rev: v2.32.0
6060
hooks:
6161
- id: pyupgrade
6262
args: [--py38-plus]
@@ -71,7 +71,7 @@ repos:
7171
types: [text] # overwrite types: [rst]
7272
types_or: [python, rst]
7373
- repo: https://github.com/sphinx-contrib/sphinx-lint
74-
rev: v0.2
74+
rev: v0.4.1
7575
hooks:
7676
- id: sphinx-lint
7777
- repo: https://github.com/asottile/yesqa

asv_bench/benchmarks/tslibs/tz_convert.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111

1212
try:
1313
old_sig = False
14-
from pandas._libs.tslibs.tzconversion import tz_convert_from_utc
14+
from pandas._libs.tslibs import tz_convert_from_utc
1515
except ImportError:
16-
old_sig = True
17-
from pandas._libs.tslibs.tzconversion import tz_convert as tz_convert_from_utc
16+
try:
17+
old_sig = False
18+
from pandas._libs.tslibs.tzconversion import tz_convert_from_utc
19+
except ImportError:
20+
old_sig = True
21+
from pandas._libs.tslibs.tzconversion import tz_convert as tz_convert_from_utc
1822

1923

2024
class TimeTZConvert:

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
pip install cython numpy python-dateutil pytz pytest pytest-xdist pytest-asyncio>=0.17 hypothesis && \
4949
python setup.py build_ext -q -j2 && \
5050
python -m pip install --no-build-isolation -e . && \
51+
export PANDAS_CI=1 && \
5152
pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas --junitxml=test-data.xml"
5253
displayName: 'Run 32-bit manylinux2014 Docker Build / Tests'
5354

ci/code_checks.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
# $ ./ci/code_checks.sh doctests # run doctests
1313
# $ ./ci/code_checks.sh docstrings # validate docstring errors
1414
# $ ./ci/code_checks.sh typing # run static type analysis
15+
# $ ./ci/code_checks.sh single-docs # check single-page docs build warning-free
1516

16-
[[ -z "$1" || "$1" == "code" || "$1" == "doctests" || "$1" == "docstrings" || "$1" == "typing" ]] || \
17+
[[ -z "$1" || "$1" == "code" || "$1" == "doctests" || "$1" == "docstrings" || "$1" == "typing" || "$1" == "single-docs" ]] || \
1718
{ echo "Unknown command $1. Usage: $0 [code|doctests|docstrings|typing]"; exit 9999; }
1819

1920
BASE_DIR="$(dirname $0)/.."
@@ -102,4 +103,11 @@ if [[ -z "$CHECK" || "$CHECK" == "typing" ]]; then
102103
fi
103104
fi
104105

106+
### SINGLE-PAGE DOCS ###
107+
if [[ -z "$CHECK" || "$CHECK" == "single-docs" ]]; then
108+
python doc/make.py --warnings-are-errors --single pandas.Series.value_counts
109+
python doc/make.py --warnings-are-errors --single pandas.Series.str.split
110+
python doc/make.py clean
111+
fi
112+
105113
exit $RET

doc/source/development/policies.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pandas may change the behavior of experimental features at any time.
5151
Python support
5252
~~~~~~~~~~~~~~
5353

54-
pandas will only drop support for specific Python versions (e.g. 3.6.x, 3.7.x) in
55-
pandas **major** or **minor** releases.
54+
pandas mirrors the `NumPy guidelines for Python support <https://numpy.org/neps/nep-0029-deprecation_policy.html#implementation>`__.
55+
5656

5757
.. _SemVer: https://semver.org

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

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
{{ header }}
44

5+
How do I create plots in pandas?
6+
----------------------------------
7+
8+
.. image:: ../../_static/schemas/04_plot_overview.svg
9+
:align: center
10+
511
.. ipython:: python
612
713
import pandas as pd
@@ -35,12 +41,6 @@
3541
</ul>
3642
</div>
3743

38-
How to create plots in pandas?
39-
------------------------------
40-
41-
.. image:: ../../_static/schemas/04_plot_overview.svg
42-
:align: center
43-
4444
.. raw:: html
4545

4646
<ul class="task-bullet">
@@ -52,6 +52,7 @@ I want a quick visual check of the data.
5252
5353
@savefig 04_airqual_quick.png
5454
air_quality.plot()
55+
plt.show()
5556
5657
With a ``DataFrame``, pandas creates by default one line plot for each of
5758
the columns with numeric data.
@@ -68,10 +69,19 @@ the columns with numeric data.
6869

6970
I want to plot only the columns of the data table with the data from Paris.
7071

72+
.. ipython:: python
73+
:suppress:
74+
75+
# We need to clear the figure here as, within doc generation, the plot
76+
# accumulates data on each plot(). This is not needed when running
77+
# in a notebook, so is suppressed from output.
78+
plt.clf()
79+
7180
.. ipython:: python
7281
7382
@savefig 04_airqual_paris.png
7483
air_quality["station_paris"].plot()
84+
plt.show()
7585
7686
To plot a specific column, use the selection method of the
7787
:ref:`subset data tutorial <10min_tut_03_subset>` in combination with the :meth:`~DataFrame.plot`
@@ -94,6 +104,7 @@ I want to visually compare the :math:`NO_2` values measured in London versus Par
94104
95105
@savefig 04_airqual_scatter.png
96106
air_quality.plot.scatter(x="station_london", y="station_paris", alpha=0.5)
107+
plt.show()
97108
98109
.. raw:: html
99110

@@ -125,6 +136,7 @@ method is applicable on the air quality example data:
125136
126137
@savefig 04_airqual_boxplot.png
127138
air_quality.plot.box()
139+
plt.show()
128140
129141
.. raw:: html
130142

@@ -148,6 +160,7 @@ I want each of the columns in a separate subplot.
148160
149161
@savefig 04_airqual_area_subplot.png
150162
axs = air_quality.plot.area(figsize=(12, 4), subplots=True)
163+
plt.show()
151164
152165
Separate subplots for each of the data columns are supported by the ``subplots`` argument
153166
of the ``plot`` functions. The builtin options available in each of the pandas plot
@@ -180,9 +193,10 @@ I want to further customize, extend or save the resulting plot.
180193
181194
fig, axs = plt.subplots(figsize=(12, 4))
182195
air_quality.plot.area(ax=axs)
183-
@savefig 04_airqual_customized.png
184196
axs.set_ylabel("NO$_2$ concentration")
197+
@savefig 04_airqual_customized.png
185198
fig.savefig("no2_concentrations.png")
199+
plt.show()
186200
187201
.. ipython:: python
188202
:suppress:
@@ -208,6 +222,7 @@ This strategy is applied in the previous example:
208222
air_quality.plot.area(ax=axs) # Use pandas to put the area plot on the prepared Figure/Axes
209223
axs.set_ylabel("NO$_2$ concentration") # Do any Matplotlib customization you like
210224
fig.savefig("no2_concentrations.png") # Save the Figure/Axes using the existing Matplotlib method.
225+
plt.show() # Display the plot
211226

212227
.. raw:: html
213228

doc/source/index.rst.template

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pandas documentation
2626
easy-to-use data structures and data analysis tools for the `Python <https://www.python.org/>`__
2727
programming language.
2828

29+
{% if not single_doc -%}
2930
.. panels::
3031
:card: + intro-card text-center
3132
:column: col-lg-6 col-md-6 col-sm-6 col-xs-12 d-flex
@@ -96,16 +97,22 @@ programming language.
9697
:text: To the development guide
9798
:classes: btn-block btn-secondary stretched-link
9899

99-
100+
{% endif %}
100101
{% if single_doc and single_doc.endswith('.rst') -%}
101102
.. toctree::
102103
:maxdepth: 3
103104
:titlesonly:
104105

105106
{{ single_doc[:-4] }}
107+
{% elif single_doc and single_doc.count('.') <= 1 %}
108+
.. autosummary::
109+
:toctree: reference/api/
110+
111+
{{ single_doc }}
106112
{% elif single_doc %}
107113
.. autosummary::
108114
:toctree: reference/api/
115+
:template: autosummary/accessor_method.rst
109116

110117
{{ single_doc }}
111118
{% else -%}

doc/source/reference/frame.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,4 @@ Serialization / IO / conversion
391391
DataFrame.to_clipboard
392392
DataFrame.to_markdown
393393
DataFrame.style
394+
DataFrame.__dataframe__

doc/source/reference/general_functions.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,10 @@ Hashing
7878

7979
util.hash_array
8080
util.hash_pandas_object
81+
82+
Importing from other DataFrame libraries
83+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
84+
.. autosummary::
85+
:toctree: api/
86+
87+
api.exchange.from_dataframe

doc/source/user_guide/gotchas.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ integer arrays to floating when NAs must be introduced.
367367
Differences with NumPy
368368
----------------------
369369
For :class:`Series` and :class:`DataFrame` objects, :meth:`~DataFrame.var` normalizes by
370-
``N-1`` to produce unbiased estimates of the sample variance, while NumPy's
370+
``N-1`` to produce `unbiased estimates of the population variance <https://en.wikipedia.org/wiki/Bias_of_an_estimator>`__, while NumPy's
371371
:meth:`numpy.var` normalizes by N, which measures the variance of the sample. Note that
372372
:meth:`~DataFrame.cov` normalizes by ``N-1`` in both pandas and NumPy.
373373

0 commit comments

Comments
 (0)