Skip to content

Commit c8e077f

Browse files
committed
Merge branch 'master' of https://github.com/pandas-dev/pandas into 40480
2 parents 7574312 + 88df92f commit c8e077f

File tree

131 files changed

+3029
-1690
lines changed

Some content is hidden

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

131 files changed

+3029
-1690
lines changed

.pre-commit-config.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
minimum_pre_commit_version: 2.9.2
22
exclude: ^LICENSES/|\.(html|csv|svg)$
3+
ci:
4+
autofix_prs: false
35
repos:
46
- repo: https://github.com/MarcoGorelli/absolufy-imports
57
rev: v0.3.0
@@ -51,7 +53,7 @@ repos:
5153
hooks:
5254
- id: isort
5355
- repo: https://github.com/asottile/pyupgrade
54-
rev: v2.11.0
56+
rev: v2.12.0
5557
hooks:
5658
- id: pyupgrade
5759
args: [--py37-plus]

.travis.yml

+2-9
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,9 @@ matrix:
3535
fast_finish: true
3636

3737
include:
38-
- arch: arm64
38+
- arch: arm64-graviton2
3939
env:
40-
- JOB="3.7, arm64" PYTEST_WORKERS=1 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard and not arm_slow)"
41-
42-
allow_failures:
43-
# Moved to allowed_failures 2020-09-29 due to timeouts https://github.com/pandas-dev/pandas/issues/36719
44-
- arch: arm64
45-
env:
46-
- JOB="3.7, arm64" PYTEST_WORKERS=1 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard and not arm_slow)"
47-
40+
- JOB="3.7, arm64" PYTEST_WORKERS="auto" ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard and not arm_slow)"
4841

4942
before_install:
5043
- echo "before_install"

asv_bench/benchmarks/groupby.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,19 @@ class GroupByCythonAgg:
480480
param_names = ["dtype", "method"]
481481
params = [
482482
["float64"],
483-
["sum", "prod", "min", "max", "mean", "median", "var", "first", "last"],
483+
[
484+
"sum",
485+
"prod",
486+
"min",
487+
"max",
488+
"mean",
489+
"median",
490+
"var",
491+
"first",
492+
"last",
493+
"any",
494+
"all",
495+
],
484496
]
485497

486498
def setup(self, dtype, method):

doc/_templates/sidebar-nav-bs.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation">
2+
<div class="bd-toc-item active">
3+
{% if pagename.startswith("reference") %}
4+
{{ generate_nav_html("sidebar", maxdepth=4, collapse=True, includehidden=True, titles_only=True) }}
5+
{% else %}
6+
{{ generate_nav_html("sidebar", maxdepth=4, collapse=False, includehidden=True, titles_only=True) }}
7+
{% endif %}
8+
</div>
9+
</nav>
7.14 KB
Loading
7.33 KB
Loading
7.59 KB
Loading
7.1 KB
Loading

doc/source/reference/style.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Styler properties
2323
:toctree: api/
2424

2525
Styler.env
26-
Styler.template
26+
Styler.template_html
2727
Styler.loader
2828

2929
Style application
@@ -53,6 +53,7 @@ Builtin styles
5353
Styler.highlight_null
5454
Styler.highlight_max
5555
Styler.highlight_min
56+
Styler.highlight_between
5657
Styler.background_gradient
5758
Styler.bar
5859

doc/source/user_guide/advanced.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ values across a level. For instance:
498498
)
499499
df = pd.DataFrame(np.random.randn(4, 2), index=midx)
500500
df
501-
df2 = df.mean(level=0)
501+
df2 = df.groupby(level=0).mean()
502502
df2
503503
df2.reindex(df.index, level=0)
504504

doc/source/user_guide/categorical.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ even if some categories are not present in the data:
633633
data=[[1, 2, 3], [4, 5, 6]],
634634
columns=pd.MultiIndex.from_arrays([["A", "B", "B"], columns]),
635635
)
636-
df.sum(axis=1, level=1)
636+
df.groupby(axis=1, level=1).sum()
637637
638638
Groupby will also show "unused" categories:
639639

doc/source/user_guide/groupby.rst

-8
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,6 @@ number:
320320
321321
s.groupby(level="second").sum()
322322
323-
The aggregation functions such as ``sum`` will take the level parameter
324-
directly. Additionally, the resulting index will be named according to the
325-
chosen level:
326-
327-
.. ipython:: python
328-
329-
s.sum(level="second")
330-
331323
Grouping with multiple levels is supported.
332324

333325
.. ipython:: python

doc/source/user_guide/style.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,7 @@
17101710
" Styler.loader, # the default\n",
17111711
" ])\n",
17121712
" )\n",
1713-
" template = env.get_template(\"myhtml.tpl\")"
1713+
" template_html = env.get_template(\"myhtml.tpl\")"
17141714
]
17151715
},
17161716
{

doc/source/user_guide/window.rst

+2
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ By default the labels are set to the right edge of the window, but a
158158
159159
160160
This can also be applied to datetime-like indices.
161+
161162
.. versionadded:: 1.3
163+
162164
.. ipython:: python
163165
164166
df = pd.DataFrame(

doc/source/whatsnew/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Version 1.2
2424
.. toctree::
2525
:maxdepth: 2
2626

27+
v1.2.5
2728
v1.2.4
2829
v1.2.3
2930
v1.2.2

doc/source/whatsnew/v0.15.2.rst

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ Other enhancements:
154154
- ``Series.all`` and ``Series.any`` now support the ``level`` and ``skipna`` parameters (:issue:`8302`):
155155

156156
.. ipython:: python
157+
:okwarning:
157158
158159
s = pd.Series([False, True, False], index=[0, 0, 1])
159160
s.any(level=0)

doc/source/whatsnew/v1.2.4.rst

+5-24
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _whatsnew_124:
22

3-
What's new in 1.2.4 (April ??, 2021)
4-
---------------------------------------
3+
What's new in 1.2.4 (April 12, 2021)
4+
------------------------------------
55

66
These are the changes in pandas 1.2.4. See :ref:`release` for a full changelog
77
including other versions of pandas.
@@ -20,27 +20,8 @@ Fixed regressions
2020
- Fixed regression in (in)equality comparison of ``pd.NaT`` with a non-datetimelike numpy array returning a scalar instead of an array (:issue:`40722`)
2121
- Fixed regression in :meth:`DataFrame.where` not returning a copy in the case of an all True condition (:issue:`39595`)
2222
- Fixed regression in :meth:`DataFrame.replace` raising ``IndexError`` when ``regex`` was a multi-key dictionary (:issue:`39338`)
23-
-
24-
25-
.. ---------------------------------------------------------------------------
26-
27-
.. _whatsnew_124.bug_fixes:
28-
29-
Bug fixes
30-
~~~~~~~~~
31-
32-
-
33-
-
34-
35-
.. ---------------------------------------------------------------------------
36-
37-
.. _whatsnew_124.other:
38-
39-
Other
40-
~~~~~
41-
42-
-
43-
-
23+
- Fixed regression in repr of floats in an ``object`` column not respecting ``float_format`` when printed in the console or outputted through :meth:`DataFrame.to_string`, :meth:`DataFrame.to_html`, and :meth:`DataFrame.to_latex` (:issue:`40024`)
24+
- Fixed regression in NumPy ufuncs such as ``np.add`` not passing through all arguments for :class:`DataFrame` (:issue:`40662`)
4425

4526
.. ---------------------------------------------------------------------------
4627
@@ -49,4 +30,4 @@ Other
4930
Contributors
5031
~~~~~~~~~~~~
5132

52-
.. contributors:: v1.2.3..v1.2.4|HEAD
33+
.. contributors:: v1.2.3..v1.2.4

doc/source/whatsnew/v1.2.5.rst

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.. _whatsnew_125:
2+
3+
What's new in 1.2.5 (May ??, 2021)
4+
----------------------------------
5+
6+
These are the changes in pandas 1.2.5. See :ref:`release` for a full changelog
7+
including other versions of pandas.
8+
9+
{{ header }}
10+
11+
.. ---------------------------------------------------------------------------
12+
13+
.. _whatsnew_125.regressions:
14+
15+
Fixed regressions
16+
~~~~~~~~~~~~~~~~~
17+
18+
-
19+
-
20+
21+
.. ---------------------------------------------------------------------------
22+
23+
.. _whatsnew_125.bug_fixes:
24+
25+
Bug fixes
26+
~~~~~~~~~
27+
28+
-
29+
-
30+
31+
.. ---------------------------------------------------------------------------
32+
33+
.. _whatsnew_125.other:
34+
35+
Other
36+
~~~~~
37+
38+
-
39+
-
40+
41+
.. ---------------------------------------------------------------------------
42+
43+
.. _whatsnew_125.contributors:
44+
45+
Contributors
46+
~~~~~~~~~~~~
47+
48+
.. contributors:: v1.2.4..v1.2.5|HEAD

doc/source/whatsnew/v1.3.0.rst

+26-8
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ We provided some focused development on :class:`.Styler`, including altering met
117117
to accept more universal CSS language for arguments, such as ``'color:red;'`` instead of
118118
``[('color', 'red')]`` (:issue:`39564`). This is also added to the built-in methods
119119
to allow custom CSS highlighting instead of default background coloring (:issue:`40242`).
120+
Enhancements to other built-in methods include extending the :meth:`.Styler.background_gradient`
121+
method to shade elements based on a given gradient map and not be restricted only to
122+
values in the DataFrame (:issue:`39930` :issue:`22727` :issue:`28901`).
120123

121124
The :meth:`.Styler.apply` now consistently allows functions with ``ndarray`` output to
122125
allow more flexible development of UDFs when ``axis`` is ``None`` ``0`` or ``1`` (:issue:`39393`).
@@ -206,13 +209,17 @@ Other enhancements
206209
- :meth:`.Styler.background_gradient` now allows the ability to supply a specific gradient map (:issue:`22727`)
207210
- :meth:`.Styler.clear` now clears :attr:`Styler.hidden_index` and :attr:`Styler.hidden_columns` as well (:issue:`40484`)
208211
- Builtin highlighting methods in :class:`Styler` have a more consistent signature and css customisability (:issue:`40242`)
212+
- :meth:`.Styler.highlight_between` added to list of builtin styling methods (:issue:`39821`)
209213
- :meth:`Series.loc.__getitem__` and :meth:`Series.loc.__setitem__` with :class:`MultiIndex` now raising helpful error message when indexer has too many dimensions (:issue:`35349`)
210214
- :meth:`pandas.read_stata` and :class:`StataReader` support reading data from compressed files.
211215
- Add support for parsing ``ISO 8601``-like timestamps with negative signs to :meth:`pandas.Timedelta` (:issue:`37172`)
212216
- Add support for unary operators in :class:`FloatingArray` (:issue:`38749`)
213217
- :class:`RangeIndex` can now be constructed by passing a ``range`` object directly e.g. ``pd.RangeIndex(range(3))`` (:issue:`12067`)
214218
- :meth:`round` being enabled for the nullable integer and floating dtypes (:issue:`38844`)
215219
- :meth:`pandas.read_csv` and :meth:`pandas.read_json` expose the argument ``encoding_errors`` to control how encoding errors are handled (:issue:`39450`)
220+
- :meth:`.GroupBy.any` and :meth:`.GroupBy.all` use Kleene logic with nullable data types (:issue:`37506`)
221+
- :meth:`.GroupBy.any` and :meth:`.GroupBy.all` return a ``BooleanDtype`` for columns with nullable data types (:issue:`33449`)
222+
-
216223

217224
.. ---------------------------------------------------------------------------
218225
@@ -563,6 +570,7 @@ Deprecations
563570
- Deprecated allowing partial failure in :meth:`Series.transform` and :meth:`DataFrame.transform` when ``func`` is list-like or dict-like and raises anything but ``TypeError``; ``func`` raising anything but a ``TypeError`` will raise in a future version (:issue:`40211`)
564571
- Deprecated support for ``np.ma.mrecords.MaskedRecords`` in the :class:`DataFrame` constructor, pass ``{name: data[name] for name in data.dtype.names}`` instead (:issue:`40363`)
565572
- Deprecated the use of ``**kwargs`` in :class:`.ExcelWriter`; use the keyword argument ``engine_kwargs`` instead (:issue:`40430`)
573+
- Deprecated the ``level`` keyword for :class:`DataFrame` and :class:`Series` aggregations; use groupby instead (:issue:`39983`)
566574

567575
.. ---------------------------------------------------------------------------
568576
@@ -584,6 +592,7 @@ Performance improvements
584592
- Performance improvement in :class:`Styler` where render times are more than 50% reduced (:issue:`39972` :issue:`39952`)
585593
- Performance improvement in :meth:`core.window.ewm.ExponentialMovingWindow.mean` with ``times`` (:issue:`39784`)
586594
- Performance improvement in :meth:`.GroupBy.apply` when requiring the python fallback implementation (:issue:`40176`)
595+
- Performance improvement for concatenation of data with type :class:`CategoricalDtype` (:issue:`40193`)
587596

588597
.. ---------------------------------------------------------------------------
589598
@@ -781,11 +790,14 @@ Groupby/resample/rolling
781790
- Bug in :meth:`Series.asfreq` and :meth:`DataFrame.asfreq` dropping rows when the index is not sorted (:issue:`39805`)
782791
- Bug in aggregation functions for :class:`DataFrame` not respecting ``numeric_only`` argument when ``level`` keyword was given (:issue:`40660`)
783792
- Bug in :class:`core.window.RollingGroupby` where ``as_index=False`` argument in ``groupby`` was ignored (:issue:`39433`)
793+
- Bug in :meth:`.GroupBy.any` and :meth:`.GroupBy.all` raising ``ValueError`` when using with nullable type columns holding ``NA`` even with ``skipna=True`` (:issue:`40585`)
794+
784795

785796
Reshaping
786797
^^^^^^^^^
787798
- Bug in :func:`merge` raising error when performing an inner join with partial index and ``right_index`` when no overlap between indices (:issue:`33814`)
788799
- Bug in :meth:`DataFrame.unstack` with missing levels led to incorrect index names (:issue:`37510`)
800+
- Bug in :func:`merge_asof` propagating the right Index with ``left_index=True`` and ``right_on`` specification instead of left Index (:issue:`33463`)
789801
- Bug in :func:`join` over :class:`MultiIndex` returned wrong result, when one of both indexes had only one level (:issue:`36909`)
790802
- :meth:`merge_asof` raises ``ValueError`` instead of cryptic ``TypeError`` in case of non-numerical merge columns (:issue:`29130`)
791803
- Bug in :meth:`DataFrame.join` not assigning values correctly when having :class:`MultiIndex` where at least one dimension is from dtype ``Categorical`` with non-alphabetically sorted categories (:issue:`38502`)
@@ -813,26 +825,32 @@ ExtensionArray
813825

814826
- Bug in :meth:`DataFrame.where` when ``other`` is a :class:`Series` with :class:`ExtensionArray` dtype (:issue:`38729`)
815827
- Fixed bug where :meth:`Series.idxmax`, :meth:`Series.idxmin` and ``argmax/min`` fail when the underlying data is :class:`ExtensionArray` (:issue:`32749`, :issue:`33719`, :issue:`36566`)
828+
- Fixed a bug where some properties of subclasses of :class:`PandasExtensionDtype` where improperly cached (:issue:`40329`)
816829
-
817830

831+
Styler
832+
^^^^^^
833+
834+
- Bug in :class:`Styler` where ``subset`` arg in methods raised an error for some valid multiindex slices (:issue:`33562`)
835+
- :class:`Styler` rendered HTML output minor alterations to support w3 good code standard (:issue:`39626`)
836+
- Bug in :class:`Styler` where rendered HTML was missing a column class identifier for certain header cells (:issue:`39716`)
837+
- Bug in :meth:`Styler.background_gradient` where text-color was not determined correctly (:issue:`39888`)
838+
- Bug in :class:`Styler` where multiple elements in CSS-selectors were not correctly added to ``table_styles`` (:issue:`39942`)
839+
- Bug in :class:`.Styler` where copying from Jupyter dropped top left cell and misaligned headers (:issue:`12147`)
840+
- Bug in :class:`.Styler.where` where ``kwargs`` were not passed to the applicable callable (:issue:`40845`)
841+
- Bug in :class:`Styler` which caused CSS to duplicate on multiple renders. (:issue:`39395`, :issue:`40334`)
842+
843+
818844
Other
819845
^^^^^
820846
- Bug in :class:`Index` constructor sometimes silently ignoring a specified ``dtype`` (:issue:`38879`)
821847
- Bug in :func:`pandas.api.types.infer_dtype` not recognizing Series, Index or array with a period dtype (:issue:`23553`)
822848
- Bug in :func:`pandas.api.types.infer_dtype` raising an error for general :class:`.ExtensionArray` objects. It will now return ``"unknown-array"`` instead of raising (:issue:`37367`)
823849
- Bug in constructing a :class:`Series` from a list and a :class:`PandasDtype` (:issue:`39357`)
824-
- Bug in :class:`Styler` which caused CSS to duplicate on multiple renders. (:issue:`39395`, :issue:`40334`)
825850
- ``inspect.getmembers(Series)`` no longer raises an ``AbstractMethodError`` (:issue:`38782`)
826851
- Bug in :meth:`Series.where` with numeric dtype and ``other = None`` not casting to ``nan`` (:issue:`39761`)
827852
- :meth:`Index.where` behavior now mirrors :meth:`Index.putmask` behavior, i.e. ``index.where(mask, other)`` matches ``index.putmask(~mask, other)`` (:issue:`39412`)
828853
- Bug in :func:`pandas.testing.assert_series_equal`, :func:`pandas.testing.assert_frame_equal`, :func:`pandas.testing.assert_index_equal` and :func:`pandas.testing.assert_extension_array_equal` incorrectly raising when an attribute has an unrecognized NA type (:issue:`39461`)
829-
- Bug in :class:`Styler` where ``subset`` arg in methods raised an error for some valid multiindex slices (:issue:`33562`)
830-
- :class:`Styler` rendered HTML output minor alterations to support w3 good code standard (:issue:`39626`)
831-
- Bug in :class:`Styler` where rendered HTML was missing a column class identifier for certain header cells (:issue:`39716`)
832-
- Bug in :meth:`Styler.background_gradient` where text-color was not determined correctly (:issue:`39888`)
833-
- Bug in :class:`Styler` where multiple elements in CSS-selectors were not correctly added to ``table_styles`` (:issue:`39942`)
834-
- Bug in :class:`.Styler` where copying from Jupyter dropped top left cell and misaligned headers (:issue:`12147`)
835-
- Bug in :class:`.Styler.where` where ``kwargs`` were not passed to the applicable callable (:issue:`40845`)
836854
- Bug in :meth:`DataFrame.equals`, :meth:`Series.equals`, :meth:`Index.equals` with object-dtype containing ``np.datetime64("NaT")`` or ``np.timedelta64("NaT")`` (:issue:`39650`)
837855
- Bug in :func:`pandas.util.show_versions` where console JSON output was not proper JSON (:issue:`39701`)
838856
- Bug in :meth:`DataFrame.convert_dtypes` incorrectly raised ValueError when called on an empty DataFrame (:issue:`40393`)

0 commit comments

Comments
 (0)