Skip to content

Commit cf95a20

Browse files
authored
Merge branch 'main' into improve-formatters-docstring
2 parents 5a9f6da + d831326 commit cf95a20

File tree

390 files changed

+2581
-3007
lines changed

Some content is hidden

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

390 files changed

+2581
-3007
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ci:
1919
skip: [pylint, pyright, mypy]
2020
repos:
2121
- repo: https://github.com/astral-sh/ruff-pre-commit
22-
rev: v0.1.13
22+
rev: v0.3.1
2323
hooks:
2424
- id: ruff
2525
args: [--exit-non-zero-on-fix]

asv_bench/benchmarks/indexing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
lower-level methods directly on Index and subclasses, see index_object.py,
44
indexing_engine.py, and index_cached.py
55
"""
6+
67
from datetime import datetime
78
import warnings
89

asv_bench/benchmarks/libs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
If a PR does not edit anything in _libs/, then it is unlikely that the
66
benchmarks will be affected.
77
"""
8+
89
import numpy as np
910

1011
from pandas._libs.lib import (

asv_bench/benchmarks/package.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Benchmarks for pandas at the package-level.
33
"""
4+
45
import subprocess
56
import sys
67

asv_bench/benchmarks/period.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Period benchmarks with non-tslibs dependencies. See
33
benchmarks.tslibs.period for benchmarks that rely only on tslibs.
44
"""
5+
56
from pandas import (
67
DataFrame,
78
Period,

asv_bench/benchmarks/tslibs/offsets.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
offsets benchmarks that rely only on tslibs. See benchmarks.offset for
33
offsets benchmarks that rely on other parts of pandas.
44
"""
5+
56
from datetime import datetime
67

78
import numpy as np

asv_bench/benchmarks/tslibs/resolution.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
df.loc[key] = (val.average, val.stdev)
1818
1919
"""
20+
2021
import numpy as np
2122

2223
try:

asv_bench/benchmarks/tslibs/timedelta.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Timedelta benchmarks that rely only on tslibs. See benchmarks.timedeltas for
33
Timedelta benchmarks that rely on other parts of pandas.
44
"""
5+
56
import datetime
67

78
import numpy as np

asv_bench/benchmarks/tslibs/tslib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
val = %timeit -o tr.time_ints_to_pydatetime(box, size, tz)
1616
df.loc[key] = (val.average, val.stdev)
1717
"""
18+
1819
from datetime import (
1920
timedelta,
2021
timezone,

ci/code_checks.sh

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ fi
6565
### DOCSTRINGS ###
6666
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
6767

68-
MSG='Validate docstrings (EX01, EX03, EX04, GL01, GL02, GL03, GL04, GL05, GL06, GL07, GL09, GL10, PR03, PR04, PR05, PR06, PR08, PR09, PR10, RT01, RT02, RT04, RT05, SA02, SA03, SA04, SA05, SS01, SS02, SS03, SS04, SS05, SS06)' ; echo $MSG
69-
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX01,EX03,EX04,GL01,GL02,GL03,GL04,GL05,GL06,GL07,GL09,GL10,PR03,PR04,PR05,PR06,PR08,PR09,PR10,RT01,RT02,RT04,RT05,SA02,SA03,SA04,SA05,SS01,SS02,SS03,SS04,SS05,SS06
68+
MSG='Validate docstrings (EX01, EX03, EX04, GL01, GL02, GL03, GL04, GL05, GL06, GL07, GL09, GL10, PD01, PR03, PR04, PR05, PR06, PR08, PR09, PR10, RT01, RT02, RT04, RT05, SA02, SA03, SA04, SA05, SS01, SS02, SS03, SS04, SS05, SS06)' ; echo $MSG
69+
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX01,EX03,EX04,GL01,GL02,GL03,GL04,GL05,GL06,GL07,GL09,GL10,PD01,PR03,PR04,PR05,PR06,PR08,PR09,PR10,RT01,RT02,RT04,RT05,SA02,SA03,SA04,SA05,SS01,SS02,SS03,SS04,SS05,SS06
7070
RET=$(($RET + $?)) ; echo $MSG "DONE"
7171

7272
MSG='Partially validate docstrings (PR02)' ; echo $MSG
@@ -144,7 +144,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
144144

145145
MSG='Partially validate docstrings (GL08)' ; echo $MSG
146146
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=GL08 --ignore_functions \
147-
pandas.ExcelFile.book\
148147
pandas.Index.empty\
149148
pandas.Index.names\
150149
pandas.Index.view\
@@ -490,23 +489,11 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
490489
pandas.errors.AbstractMethodError\
491490
pandas.errors.UndefinedVariableError\
492491
pandas.get_option\
493-
pandas.io.formats.style.Styler.to_excel\
494-
pandas.melt\
495-
pandas.option_context\
496-
pandas.read_fwf\
497-
pandas.reset_option # There should be no backslash in the final line, please keep this comment in the last ignored function
492+
pandas.io.formats.style.Styler.to_excel # There should be no backslash in the final line, please keep this comment in the last ignored function
498493
RET=$(($RET + $?)) ; echo $MSG "DONE"
499494

500495
MSG='Partially validate docstrings (PR07)' ; echo $MSG
501496
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=PR07 --ignore_functions \
502-
pandas.DataFrame.get\
503-
pandas.DataFrame.rolling\
504-
pandas.DataFrame.to_hdf\
505-
pandas.DatetimeIndex.indexer_between_time\
506-
pandas.DatetimeIndex.mean\
507-
pandas.HDFStore.append\
508-
pandas.HDFStore.get\
509-
pandas.HDFStore.put\
510497
pandas.Index\
511498
pandas.Index.append\
512499
pandas.Index.copy\
@@ -614,39 +601,21 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
614601

615602
MSG='Partially validate docstrings (RT03)' ; echo $MSG
616603
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=RT03 --ignore_functions \
617-
pandas.DataFrame.expanding\
618-
pandas.DataFrame.filter\
619-
pandas.DataFrame.first_valid_index\
620-
pandas.DataFrame.get\
621604
pandas.DataFrame.hist\
622605
pandas.DataFrame.infer_objects\
623606
pandas.DataFrame.kurt\
624607
pandas.DataFrame.kurtosis\
625-
pandas.DataFrame.last_valid_index\
626608
pandas.DataFrame.mask\
627609
pandas.DataFrame.max\
628610
pandas.DataFrame.mean\
629611
pandas.DataFrame.median\
630612
pandas.DataFrame.min\
631-
pandas.DataFrame.nsmallest\
632-
pandas.DataFrame.nunique\
633-
pandas.DataFrame.pipe\
634-
pandas.DataFrame.plot.box\
635-
pandas.DataFrame.plot.density\
636-
pandas.DataFrame.plot.kde\
637-
pandas.DataFrame.plot.scatter\
638-
pandas.DataFrame.pop\
639613
pandas.DataFrame.prod\
640614
pandas.DataFrame.product\
641-
pandas.DataFrame.reindex\
642-
pandas.DataFrame.reorder_levels\
643615
pandas.DataFrame.sem\
644616
pandas.DataFrame.skew\
645617
pandas.DataFrame.std\
646618
pandas.DataFrame.sum\
647-
pandas.DataFrame.swapaxes\
648-
pandas.DataFrame.to_numpy\
649-
pandas.DataFrame.to_orc\
650619
pandas.DataFrame.to_parquet\
651620
pandas.DataFrame.unstack\
652621
pandas.DataFrame.value_counts\
@@ -866,29 +835,18 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
866835
pandas.plotting.parallel_coordinates\
867836
pandas.plotting.radviz\
868837
pandas.plotting.table\
869-
pandas.read_orc\
870-
pandas.read_sas\
871-
pandas.read_spss\
872-
pandas.read_stata\
873-
pandas.set_eng_float_format\
874-
pandas.timedelta_range\
875-
pandas.util.hash_pandas_object # There should be no backslash in the final line, please keep this comment in the last ignored function
838+
pandas.set_eng_float_format # There should be no backslash in the final line, please keep this comment in the last ignored function
876839
RET=$(($RET + $?)) ; echo $MSG "DONE"
877840

878841
MSG='Partially validate docstrings (SA01)' ; echo $MSG
879842
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=SA01 --ignore_functions \
880-
pandas.BooleanDtype\
881843
pandas.Categorical.__array__\
882-
pandas.Categorical.as_ordered\
883-
pandas.Categorical.as_unordered\
884844
pandas.Categorical.codes\
885845
pandas.Categorical.dtype\
886846
pandas.Categorical.from_codes\
887847
pandas.Categorical.ordered\
888848
pandas.CategoricalDtype.categories\
889849
pandas.CategoricalDtype.ordered\
890-
pandas.CategoricalIndex.as_ordered\
891-
pandas.CategoricalIndex.as_unordered\
892850
pandas.CategoricalIndex.codes\
893851
pandas.CategoricalIndex.ordered\
894852
pandas.DataFrame.__dataframe__\
@@ -1085,8 +1043,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
10851043
pandas.Series.backfill\
10861044
pandas.Series.bfill\
10871045
pandas.Series.cat\
1088-
pandas.Series.cat.as_ordered\
1089-
pandas.Series.cat.as_unordered\
10901046
pandas.Series.cat.codes\
10911047
pandas.Series.cat.ordered\
10921048
pandas.Series.copy\
@@ -1189,7 +1145,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
11891145
pandas.Series.update\
11901146
pandas.Series.var\
11911147
pandas.SparseDtype\
1192-
pandas.StringDtype\
11931148
pandas.Timedelta\
11941149
pandas.Timedelta.as_unit\
11951150
pandas.Timedelta.asm8\

doc/make.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
$ python make.py html
1212
$ python make.py latex
1313
"""
14+
1415
import argparse
1516
import csv
1617
import importlib

doc/source/user_guide/scale.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,5 +374,33 @@ datasets.
374374

375375
You see more dask examples at https://examples.dask.org.
376376

377+
Use Modin
378+
---------
379+
380+
Modin_ is a scalable dataframe library, which aims to be a drop-in replacement API for pandas and
381+
provides the ability to scale pandas workflows across nodes and CPUs available. It is also able
382+
to work with larger than memory datasets. To start working with Modin you just need
383+
to replace a single line of code, namely, the import statement.
384+
385+
.. code-block:: ipython
386+
387+
# import pandas as pd
388+
import modin.pandas as pd
389+
390+
After you have changed the import statement, you can proceed using the well-known pandas API
391+
to scale computation. Modin distributes computation across nodes and CPUs available utilizing
392+
an execution engine it runs on. At the time of Modin 0.27.0 the following execution engines are supported
393+
in Modin: Ray_, Dask_, `MPI through unidist`_, HDK_. The partitioning schema of a Modin DataFrame partitions it
394+
along both columns and rows because it gives Modin flexibility and scalability in both the number of columns and
395+
the number of rows.
396+
397+
For more information refer to `Modin's documentation`_ or the `Modin's tutorials`_.
398+
399+
.. _Modin: https://github.com/modin-project/modin
400+
.. _`Modin's documentation`: https://modin.readthedocs.io/en/latest
401+
.. _`Modin's tutorials`: https://github.com/modin-project/modin/tree/master/examples/tutorial/jupyter/execution
402+
.. _Ray: https://github.com/ray-project/ray
377403
.. _Dask: https://dask.org
404+
.. _`MPI through unidist`: https://github.com/modin-project/unidist
405+
.. _HDK: https://github.com/intel-ai/hdk
378406
.. _dask.dataframe: https://docs.dask.org/en/latest/dataframe.html

doc/source/user_guide/timeseries.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,8 +1327,8 @@ frequencies. We will refer to these aliases as *period aliases*.
13271327

13281328
.. deprecated:: 2.2.0
13291329

1330-
Aliases ``A``, ``H``, ``T``, ``S``, ``L``, ``U``, and ``N`` are deprecated in favour of the aliases
1331-
``Y``, ``h``, ``min``, ``s``, ``ms``, ``us``, and ``ns``.
1330+
Aliases ``H``, ``T``, ``S``, ``L``, ``U``, and ``N`` are deprecated in favour of the aliases
1331+
``h``, ``min``, ``s``, ``ms``, ``us``, and ``ns``.
13321332

13331333

13341334
Combining aliases

doc/source/whatsnew/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Version 2.2
2525
.. toctree::
2626
:maxdepth: 2
2727

28+
v2.2.2
2829
v2.2.1
2930
v2.2.0
3031

doc/source/whatsnew/v0.10.0.rst

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,18 +242,42 @@ labeled the aggregated group with the end of the interval: the next day).
242242
- Calling ``fillna`` on Series or DataFrame with no arguments is no longer
243243
valid code. You must either specify a fill value or an interpolation method:
244244

245-
.. ipython:: python
246-
:okwarning:
245+
.. code-block:: ipython
247246
248-
s = pd.Series([np.nan, 1.0, 2.0, np.nan, 4])
249-
s
250-
s.fillna(0)
251-
s.fillna(method="pad")
247+
In [6]: s = pd.Series([np.nan, 1.0, 2.0, np.nan, 4])
248+
249+
In [7]: s
250+
Out[7]:
251+
0 NaN
252+
1 1.0
253+
2 2.0
254+
3 NaN
255+
4 4.0
256+
dtype: float64
257+
258+
In [8]: s.fillna(0)
259+
Out[8]:
260+
0 0.0
261+
1 1.0
262+
2 2.0
263+
3 0.0
264+
4 4.0
265+
dtype: float64
266+
267+
In [9]: s.fillna(method="pad")
268+
Out[9]:
269+
0 NaN
270+
1 1.0
271+
2 2.0
272+
3 2.0
273+
4 4.0
274+
dtype: float64
252275
253276
Convenience methods ``ffill`` and ``bfill`` have been added:
254277

255278
.. ipython:: python
256279
280+
s = pd.Series([np.nan, 1.0, 2.0, np.nan, 4])
257281
s.ffill()
258282
259283

doc/source/whatsnew/v2.2.2.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.. _whatsnew_222:
2+
3+
What's new in 2.2.2 (April XX, 2024)
4+
---------------------------------------
5+
6+
These are the changes in pandas 2.2.2. See :ref:`release` for a full changelog
7+
including other versions of pandas.
8+
9+
{{ header }}
10+
11+
.. ---------------------------------------------------------------------------
12+
.. _whatsnew_222.regressions:
13+
14+
Fixed regressions
15+
~~~~~~~~~~~~~~~~~
16+
- :meth:`DataFrame.__dataframe__` was producing incorrect data buffers when the a column's type was a pandas nullable on with missing values (:issue:`56702`)
17+
-
18+
19+
.. ---------------------------------------------------------------------------
20+
.. _whatsnew_222.bug_fixes:
21+
22+
Bug fixes
23+
~~~~~~~~~
24+
-
25+
26+
.. ---------------------------------------------------------------------------
27+
.. _whatsnew_222.other:
28+
29+
Other
30+
~~~~~
31+
-
32+
33+
.. ---------------------------------------------------------------------------
34+
.. _whatsnew_222.contributors:
35+
36+
Contributors
37+
~~~~~~~~~~~~

0 commit comments

Comments
 (0)