Skip to content

Commit 9700b93

Browse files
Merge remote-tracking branch 'upstream/master' into bisect
2 parents bbb1b11 + ea68a18 commit 9700b93

File tree

120 files changed

+1582
-646
lines changed

Some content is hidden

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

120 files changed

+1582
-646
lines changed

.github/workflows/autoupdate-pre-commit-config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: "Update pre-commit config"
22

33
on:
44
schedule:
5-
- cron: "0 7 * * 1" # At 07:00 on each Monday.
5+
- cron: "0 7 1 * *" # At 07:00 on 1st of every month.
66
workflow_dispatch:
77

88
jobs:

asv_bench/benchmarks/dtypes.py

+20-9
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,26 @@ def time_pandas_dtype_invalid(self, dtype):
5050

5151
class SelectDtypes:
5252

53-
params = [
54-
tm.ALL_INT_NUMPY_DTYPES
55-
+ tm.ALL_INT_EA_DTYPES
56-
+ tm.FLOAT_NUMPY_DTYPES
57-
+ tm.COMPLEX_DTYPES
58-
+ tm.DATETIME64_DTYPES
59-
+ tm.TIMEDELTA64_DTYPES
60-
+ tm.BOOL_DTYPES
61-
]
53+
try:
54+
params = [
55+
tm.ALL_INT_NUMPY_DTYPES
56+
+ tm.ALL_INT_EA_DTYPES
57+
+ tm.FLOAT_NUMPY_DTYPES
58+
+ tm.COMPLEX_DTYPES
59+
+ tm.DATETIME64_DTYPES
60+
+ tm.TIMEDELTA64_DTYPES
61+
+ tm.BOOL_DTYPES
62+
]
63+
except AttributeError:
64+
params = [
65+
tm.ALL_INT_DTYPES
66+
+ tm.ALL_EA_INT_DTYPES
67+
+ tm.FLOAT_DTYPES
68+
+ tm.COMPLEX_DTYPES
69+
+ tm.DATETIME64_DTYPES
70+
+ tm.TIMEDELTA64_DTYPES
71+
+ tm.BOOL_DTYPES
72+
]
6273
param_names = ["dtype"]
6374

6475
def setup(self, dtype):

asv_bench/benchmarks/indexing.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -399,12 +399,14 @@ class ChainIndexing:
399399

400400
def setup(self, mode):
401401
self.N = 1000000
402+
self.df = DataFrame({"A": np.arange(self.N), "B": "foo"})
402403

403404
def time_chained_indexing(self, mode):
405+
df = self.df
406+
N = self.N
404407
with warnings.catch_warnings(record=True):
405408
with option_context("mode.chained_assignment", mode):
406-
df = DataFrame({"A": np.arange(self.N), "B": "foo"})
407-
df2 = df[df.A > self.N // 2]
409+
df2 = df[df.A > N // 2]
408410
df2["C"] = 1.0
409411

410412

doc/source/conf.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,6 @@
461461
# eg pandas.Series.str and pandas.Series.dt (see GH9322)
462462

463463
import sphinx # isort:skip
464-
from sphinx.util import rpartition # isort:skip
465464
from sphinx.ext.autodoc import ( # isort:skip
466465
AttributeDocumenter,
467466
Documenter,
@@ -521,8 +520,8 @@ def resolve_name(self, modname, parents, path, base):
521520
# HACK: this is added in comparison to ClassLevelDocumenter
522521
# mod_cls still exists of class.accessor, so an extra
523522
# rpartition is needed
524-
modname, accessor = rpartition(mod_cls, ".")
525-
modname, cls = rpartition(modname, ".")
523+
modname, _, accessor = mod_cls.rpartition(".")
524+
modname, _, cls = modname.rpartition(".")
526525
parents = [cls, accessor]
527526
# if the module name is still missing, get it like above
528527
if not modname:

doc/source/getting_started/comparison/includes/nth_word.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ word by index. Note there are more powerful approaches should you need them.
55
66
firstlast = pd.DataFrame({"String": ["John Smith", "Jane Cook"]})
77
firstlast["First_Name"] = firstlast["String"].str.split(" ", expand=True)[0]
8-
firstlast["Last_Name"] = firstlast["String"].str.rsplit(" ", expand=True)[0]
8+
firstlast["Last_Name"] = firstlast["String"].str.rsplit(" ", expand=True)[1]
99
firstlast

doc/source/user_guide/advanced.rst

+13-13
Original file line numberDiff line numberDiff line change
@@ -851,12 +851,12 @@ values **not** in the categories, similarly to how you can reindex **any** panda
851851
Int64Index and RangeIndex
852852
~~~~~~~~~~~~~~~~~~~~~~~~~
853853

854-
.. note::
855-
854+
.. deprecated:: 1.4.0
856855
In pandas 2.0, :class:`NumericIndex` will become the default index type for numeric types
857856
instead of ``Int64Index``, ``Float64Index`` and ``UInt64Index`` and those index types
858-
will be removed. See :ref:`here <advanced.numericindex>` for more.
859-
``RangeIndex`` however, will not be removed, as it represents an optimized version of an integer index.
857+
are therefore deprecated and will be removed in a futire version.
858+
See :ref:`here <advanced.numericindex>` for more.
859+
``RangeIndex`` will not be removed, as it represents an optimized version of an integer index.
860860

861861
:class:`Int64Index` is a fundamental basic index in pandas. This is an immutable array
862862
implementing an ordered, sliceable set.
@@ -869,12 +869,12 @@ implementing an ordered, sliceable set.
869869
Float64Index
870870
~~~~~~~~~~~~
871871

872-
.. note::
873-
874-
In pandas 2.0, :class:`NumericIndex` will become the default index type for numeric types
872+
.. deprecated:: 1.4.0
873+
:class:`NumericIndex` will become the default index type for numeric types in the future
875874
instead of ``Int64Index``, ``Float64Index`` and ``UInt64Index`` and those index types
876-
will be removed. See :ref:`here <advanced.numericindex>` for more.
877-
``RangeIndex`` however, will not be removed, as it represents an optimized version of an integer index.
875+
are therefore deprecated and will be removed in a future version of Pandas.
876+
See :ref:`here <advanced.numericindex>` for more.
877+
``RangeIndex`` will not be removed as it represents an optimized version of an integer index.
878878

879879
By default a :class:`Float64Index` will be automatically created when passing floating, or mixed-integer-floating values in index creation.
880880
This enables a pure label-based slicing paradigm that makes ``[],ix,loc`` for scalar indexing and slicing work exactly the
@@ -981,9 +981,9 @@ NumericIndex
981981
.. note::
982982

983983
In pandas 2.0, :class:`NumericIndex` will become the default index type for numeric types
984-
instead of ``Int64Index``, ``Float64Index`` and ``UInt64Index`` and those index types
985-
will be removed.
986-
``RangeIndex`` however, will not be removed, as it represents an optimized version of an integer index.
984+
instead of :class:`Int64Index`, :class:`Float64Index` and :class:`UInt64Index` and those index types
985+
are therefore deprecated and will be removed in a future version.
986+
:class:`RangeIndex` will not be removed as it represents an optimized version of an integer index.
987987

988988
:class:`NumericIndex` is an index type that can hold data of any numpy int/uint/float dtype. For example:
989989

@@ -998,7 +998,7 @@ NumericIndex
998998
``UInt64Index`` except that it can hold any numpy int, uint or float dtype.
999999

10001000
Until Pandas 2.0, you will have to call ``NumericIndex`` explicitly in order to use it, like in the example above.
1001-
In Pandas 2.0, ``NumericIndex`` will become the default pandas numeric index type and will automatically be used where appropriate.
1001+
In the future, ``NumericIndex`` will become the default pandas numeric index type and will automatically be used where appropriate.
10021002

10031003
Please notice that ``NumericIndex`` *can not* hold Pandas numeric dtypes (:class:`Int64Dtype`, :class:`Int32Dtype` etc.).
10041004

doc/source/user_guide/io.rst

+7-5
Original file line numberDiff line numberDiff line change
@@ -2502,14 +2502,16 @@ Read a URL with no options:
25022502

25032503
.. ipython:: python
25042504
2505-
url = (
2506-
"https://raw.githubusercontent.com/pandas-dev/pandas/master/"
2507-
"pandas/tests/io/data/html/spam.html"
2508-
)
2505+
url = "https://www.fdic.gov/resources/resolutions/bank-failures/failed-bank-list"
25092506
dfs = pd.read_html(url)
25102507
dfs
25112508
2512-
Read in the content of the "banklist.html" file and pass it to ``read_html``
2509+
.. note::
2510+
2511+
The data from the above URL changes every Monday so the resulting data above
2512+
and the data below may be slightly different.
2513+
2514+
Read in the content of the file from the above URL and pass it to ``read_html``
25132515
as a string:
25142516

25152517
.. ipython:: python

doc/source/user_guide/options.rst

+22-3
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ More information can be found in the `IPython documentation
138138
import pandas as pd
139139
140140
pd.set_option("display.max_rows", 999)
141-
pd.set_option("precision", 5)
141+
pd.set_option("display.precision", 5)
142142
143143
.. _options.frequently_used:
144144

@@ -253,9 +253,9 @@ This is only a suggestion.
253253
.. ipython:: python
254254
255255
df = pd.DataFrame(np.random.randn(5, 5))
256-
pd.set_option("precision", 7)
256+
pd.set_option("display.precision", 7)
257257
df
258-
pd.set_option("precision", 4)
258+
pd.set_option("display.precision", 4)
259259
df
260260
261261
``display.chop_threshold`` sets at what level pandas rounds to zero when
@@ -487,8 +487,27 @@ styler.sparse.index True "Sparsify" MultiIndex displ
487487
elements in outer levels within groups).
488488
styler.sparse.columns True "Sparsify" MultiIndex display for columns
489489
in Styler output.
490+
styler.render.repr html Standard output format for Styler rendered in Jupyter Notebook.
491+
Should be one of "html" or "latex".
490492
styler.render.max_elements 262144 Maximum number of datapoints that Styler will render
491493
trimming either rows, columns or both to fit.
494+
styler.render.encoding utf-8 Default encoding for output HTML or LaTeX files.
495+
styler.format.formatter None Object to specify formatting functions to ``Styler.format``.
496+
styler.format.na_rep None String representation for missing data.
497+
styler.format.precision 6 Precision to display floating point and complex numbers.
498+
styler.format.decimal . String representation for decimal point separator for floating
499+
point and complex numbers.
500+
styler.format.thousands None String representation for thousands separator for
501+
integers, and floating point and complex numbers.
502+
styler.format.escape None Whether to escape "html" or "latex" special
503+
characters in the display representation.
504+
styler.html.mathjax True If set to False will render specific CSS classes to
505+
table attributes that will prevent Mathjax from rendering
506+
in Jupyter Notebook.
507+
styler.latex.multicol_align r Alignment of headers in a merged column due to sparsification. Can be in {"r", "c", "l"}.
508+
styler.latex.multirow_align c Alignment of index labels in a merged row due to sparsification. Can be in {"c", "t", "b"}.
509+
styler.latex.environment None If given will replace the default ``\\begin{table}`` environment. If "longtable" is specified
510+
this will render with a specific "longtable" template with longtable features.
492511
======================================= ============ ==================================
493512

494513

doc/source/whatsnew/v0.20.0.rst

+5-4
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,12 @@ or purely non-negative, integers. Previously, handling these integers would
248248
result in improper rounding or data-type casting, leading to incorrect results.
249249
Notably, a new numerical index, ``UInt64Index``, has been created (:issue:`14937`)
250250

251-
.. ipython:: python
251+
.. code-block:: ipython
252252
253-
idx = pd.UInt64Index([1, 2, 3])
254-
df = pd.DataFrame({'A': ['a', 'b', 'c']}, index=idx)
255-
df.index
253+
In [1]: idx = pd.UInt64Index([1, 2, 3])
254+
In [2]: df = pd.DataFrame({'A': ['a', 'b', 'c']}, index=idx)
255+
In [3]: df.index
256+
Out[3]: UInt64Index([1, 2, 3], dtype='uint64')
256257
257258
- Bug in converting object elements of array-like objects to unsigned 64-bit integers (:issue:`4471`, :issue:`14982`)
258259
- Bug in ``Series.unique()`` in which unsigned 64-bit integers were causing overflow (:issue:`14721`)

doc/source/whatsnew/v0.23.0.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -861,21 +861,21 @@ Previous behavior:
861861
862862
Current behavior:
863863

864-
.. ipython:: python
864+
.. code-block:: ipython
865865
866-
index = pd.Int64Index([-1, 0, 1])
866+
In [12]: index = pd.Int64Index([-1, 0, 1])
867867
# division by zero gives -infinity where negative,
868868
# +infinity where positive, and NaN for 0 / 0
869-
index / 0
869+
In [13]: index / 0
870870
871871
# The result of division by zero should not depend on
872872
# whether the zero is int or float
873-
index / 0.0
873+
In [14]: index / 0.0
874874
875-
index = pd.UInt64Index([0, 1])
876-
index / np.array([0, 0], dtype=np.uint64)
875+
In [15]: index = pd.UInt64Index([0, 1])
876+
In [16]: index / np.array([0, 0], dtype=np.uint64)
877877
878-
pd.RangeIndex(1, 5) / 0
878+
In [17]: pd.RangeIndex(1, 5) / 0
879879
880880
.. _whatsnew_0230.api_breaking.extract:
881881

doc/source/whatsnew/v0.25.0.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,12 @@ considered commutative, such that ``A.union(B) == B.union(A)`` (:issue:`23525`).
473473
474474
*New behavior*:
475475

476-
.. ipython:: python
476+
.. code-block:: python
477477
478-
pd.period_range('19910905', periods=2).union(pd.Int64Index([1, 2, 3]))
479-
pd.Index([], dtype=object).union(pd.Index([1, 2, 3]))
478+
In [3]: pd.period_range('19910905', periods=2).union(pd.Int64Index([1, 2, 3]))
479+
Out[3]: Index([1991-09-05, 1991-09-06, 1, 2, 3], dtype='object')
480+
In [4]: pd.Index([], dtype=object).union(pd.Index([1, 2, 3]))
481+
Out[4]: Index([1, 2, 3], dtype='object')
480482
481483
Note that integer- and floating-dtype indexes are considered "compatible". The integer
482484
values are coerced to floating point, which may result in loss of precision. See

doc/source/whatsnew/v1.3.3.rst

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Fixed regressions
1818
- Performance regression in :meth:`core.window.ewm.ExponentialMovingWindow.mean` (:issue:`42333`)
1919
- Fixed regression in :meth:`.GroupBy.agg` incorrectly raising in some cases (:issue:`42390`)
2020
- Fixed regression in :meth:`RangeIndex.where` and :meth:`RangeIndex.putmask` raising ``AssertionError`` when result did not represent a :class:`RangeIndex` (:issue:`43240`)
21+
- Fixed regression in :meth:`read_parquet` where the ``fastparquet`` engine would not work properly with fastparquet 0.7.0 (:issue:`43075`)
2122

2223
.. ---------------------------------------------------------------------------
2324

0 commit comments

Comments
 (0)