Skip to content

Commit 03d7cbf

Browse files
Merge branch 'master' into 42452
2 parents 8e2a7eb + 7963422 commit 03d7cbf

File tree

118 files changed

+2359
-1102
lines changed

Some content is hidden

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

118 files changed

+2359
-1102
lines changed

asv_bench/benchmarks/groupby.py

+12
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,18 @@ def time_category_size(self):
369369
self.draws.groupby(self.cats).size()
370370

371371

372+
class Shift:
373+
def setup(self):
374+
N = 18
375+
self.df = DataFrame({"g": ["a", "b"] * 9, "v": list(range(N))})
376+
377+
def time_defaults(self):
378+
self.df.groupby("g").shift()
379+
380+
def time_fill_value(self):
381+
self.df.groupby("g").shift(fill_value=99)
382+
383+
372384
class FillNA:
373385
def setup(self):
374386
N = 100

asv_bench/benchmarks/reshape.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def setup(self, dtype):
102102
columns = np.arange(n)
103103
if dtype == "int":
104104
values = np.arange(m * m * n).reshape(m * m, n)
105+
self.df = DataFrame(values, index, columns)
105106
else:
106107
# the category branch is ~20x slower than int. So we
107108
# cut down the size a bit. Now it's only ~3x slower.
@@ -111,7 +112,10 @@ def setup(self, dtype):
111112
values = np.take(list(string.ascii_letters), indices)
112113
values = [pd.Categorical(v) for v in values.T]
113114

114-
self.df = DataFrame(values, index, columns)
115+
self.df = DataFrame(
116+
{i: cat for i, cat in enumerate(values)}, index, columns
117+
)
118+
115119
self.df2 = self.df.iloc[:-1]
116120

117121
def time_full_product(self, dtype):

ci/code_checks.sh

+6-28
Original file line numberDiff line numberDiff line change
@@ -107,44 +107,22 @@ fi
107107
### DOCTESTS ###
108108
if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
109109

110-
MSG='Doctests for individual files' ; echo $MSG
111-
pytest -q --doctest-modules \
112-
pandas/core/accessor.py \
113-
pandas/core/aggregation.py \
114-
pandas/core/algorithms.py \
115-
pandas/core/base.py \
116-
pandas/core/construction.py \
117-
pandas/core/frame.py \
118-
pandas/core/generic.py \
119-
pandas/core/indexers.py \
120-
pandas/core/nanops.py \
121-
pandas/core/series.py \
122-
pandas/io/sql.py
123-
RET=$(($RET + $?)) ; echo $MSG "DONE"
124-
125-
MSG='Doctests for directories' ; echo $MSG
126-
pytest -q --doctest-modules \
110+
MSG='Doctests' ; echo $MSG
111+
python -m pytest --doctest-modules \
127112
pandas/_libs/ \
128113
pandas/api/ \
129114
pandas/arrays/ \
130115
pandas/compat/ \
131-
pandas/core/array_algos/ \
132-
pandas/core/arrays/ \
133-
pandas/core/computation/ \
134-
pandas/core/dtypes/ \
135-
pandas/core/groupby/ \
136-
pandas/core/indexes/ \
137-
pandas/core/ops/ \
138-
pandas/core/reshape/ \
139-
pandas/core/strings/ \
140-
pandas/core/tools/ \
141-
pandas/core/window/ \
116+
pandas/core \
142117
pandas/errors/ \
143118
pandas/io/clipboard/ \
144119
pandas/io/json/ \
145120
pandas/io/excel/ \
146121
pandas/io/parsers/ \
147122
pandas/io/sas/ \
123+
pandas/io/sql.py \
124+
pandas/io/formats/format.py \
125+
pandas/io/formats/style.py \
148126
pandas/tseries/
149127
RET=$(($RET + $?)) ; echo $MSG "DONE"
150128

ci/deps/actions-39-slow.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ dependencies:
2323
- matplotlib
2424
- moto>=1.3.14
2525
- flask
26+
- numba
2627
- numexpr
2728
- numpy
2829
- openpyxl

ci/deps/actions-39.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dependencies:
2222
- matplotlib
2323
- moto>=1.3.14
2424
- flask
25+
- numba
2526
- numexpr
2627
- numpy
2728
- openpyxl

ci/deps/azure-windows-39.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ dependencies:
2323
- matplotlib
2424
- moto>=1.3.14
2525
- flask
26+
- numba
2627
- numexpr
2728
- numpy
2829
- openpyxl

ci/run_tests.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ fi
3030
echo $PYTEST_CMD
3131
sh -c "$PYTEST_CMD"
3232

33-
PYTEST_AM_CMD="PANDAS_DATA_MANAGER=array pytest -m \"$PATTERN and arraymanager\" -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE pandas"
33+
if [[ "$PANDAS_DATA_MANAGER" != "array" ]]; then
34+
# The ArrayManager tests should have already been run by PYTEST_CMD if PANDAS_DATA_MANAGER was already set to array
35+
PYTEST_AM_CMD="PANDAS_DATA_MANAGER=array pytest -m \"$PATTERN and arraymanager\" -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE pandas"
3436

35-
echo $PYTEST_AM_CMD
36-
sh -c "$PYTEST_AM_CMD"
37+
echo $PYTEST_AM_CMD
38+
sh -c "$PYTEST_AM_CMD"
39+
fi

doc/source/_static/style/df_pipe.png

8.47 KB
Loading

doc/source/user_guide/boolean.rst

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
Nullable Boolean data type
1313
**************************
1414

15+
.. note::
16+
17+
BooleanArray is currently experimental. Its API or implementation may
18+
change without warning.
19+
1520
.. versionadded:: 1.0.0
1621

1722

doc/source/user_guide/cookbook.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ is closed.
13001300

13011301
.. ipython:: python
13021302
1303-
store = pd.HDFStore("test.h5", "w", diver="H5FD_CORE")
1303+
store = pd.HDFStore("test.h5", "w", driver="H5FD_CORE")
13041304
13051305
df = pd.DataFrame(np.random.randn(8, 3))
13061306
store["test"] = df

doc/source/user_guide/visualization.rst

+54
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,34 @@ The ``by`` keyword can be specified to plot grouped histograms:
316316
@savefig grouped_hist.png
317317
data.hist(by=np.random.randint(0, 4, 1000), figsize=(6, 4));
318318
319+
.. ipython:: python
320+
:suppress:
321+
322+
plt.close("all")
323+
np.random.seed(123456)
324+
325+
In addition, the ``by`` keyword can also be specified in :meth:`DataFrame.plot.hist`.
326+
327+
.. versionchanged:: 1.4.0
328+
329+
.. ipython:: python
330+
331+
data = pd.DataFrame(
332+
{
333+
"a": np.random.choice(["x", "y", "z"], 1000),
334+
"b": np.random.choice(["e", "f", "g"], 1000),
335+
"c": np.random.randn(1000),
336+
"d": np.random.randn(1000) - 1,
337+
},
338+
)
339+
340+
@savefig grouped_hist_by.png
341+
data.plot.hist(by=["a", "b"], figsize=(10, 5));
342+
343+
.. ipython:: python
344+
:suppress:
345+
346+
plt.close("all")
319347
320348
.. _visualization.box:
321349

@@ -448,6 +476,32 @@ columns:
448476
449477
plt.close("all")
450478
479+
You could also create groupings with :meth:`DataFrame.plot.box`, for instance:
480+
481+
.. versionchanged:: 1.4.0
482+
483+
.. ipython:: python
484+
:suppress:
485+
486+
plt.close("all")
487+
np.random.seed(123456)
488+
489+
.. ipython:: python
490+
:okwarning:
491+
492+
df = pd.DataFrame(np.random.rand(10, 3), columns=["Col1", "Col2", "Col3"])
493+
df["X"] = pd.Series(["A", "A", "A", "A", "A", "B", "B", "B", "B", "B"])
494+
495+
plt.figure();
496+
497+
@savefig box_plot_ex4.png
498+
bp = df.plot.box(column=["Col1", "Col2"], by="X")
499+
500+
.. ipython:: python
501+
:suppress:
502+
503+
plt.close("all")
504+
451505
.. _visualization.box.return:
452506

453507
In ``boxplot``, the return type can be controlled by the ``return_type``, keyword. The valid choices are ``{"axes", "dict", "both", None}``.

doc/source/whatsnew/index.rst

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

27+
v1.3.2
2728
v1.3.1
2829
v1.3.0
2930

doc/source/whatsnew/v1.3.1.rst

+8-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.. _whatsnew_131:
22

3-
What's new in 1.3.1 (July ??, 2021)
3+
What's new in 1.3.1 (July 25, 2021)
44
-----------------------------------
55

66
These are the changes in pandas 1.3.1. See :ref:`release` for a full changelog
@@ -25,6 +25,10 @@ Fixed regressions
2525
- Fixed regression in :meth:`DataFrame.isin` and :meth:`Series.isin` raising ``TypeError`` with nullable data containing at least one missing value (:issue:`42405`)
2626
- Regression in :func:`concat` between objects with bool dtype and integer dtype casting to object instead of to integer (:issue:`42092`)
2727
- Bug in :class:`Series` constructor not accepting a ``dask.Array`` (:issue:`38645`)
28+
- Fixed regression for ``SettingWithCopyWarning`` displaying incorrect stacklevel (:issue:`42570`)
29+
- Fixed regression for :func:`merge_asof` raising ``KeyError`` when one of the ``by`` columns is in the index (:issue:`34488`)
30+
- Fixed regression in :func:`to_datetime` returning pd.NaT for inputs that produce duplicated values, when ``cache=True`` (:issue:`42259`)
31+
- Fixed regression in :meth:`SeriesGroupBy.value_counts` that resulted in an ``IndexError`` when called on a Series with one row (:issue:`42618`)
2832

2933
.. ---------------------------------------------------------------------------
3034
@@ -34,16 +38,8 @@ Bug fixes
3438
~~~~~~~~~
3539
- Fixed bug in :meth:`DataFrame.transpose` dropping values when the DataFrame had an Extension Array dtype and a duplicate index (:issue:`42380`)
3640
- Fixed bug in :meth:`DataFrame.to_xml` raising ``KeyError`` when called with ``index=False`` and an offset index (:issue:`42458`)
37-
-
38-
39-
.. ---------------------------------------------------------------------------
40-
41-
.. _whatsnew_131.other:
42-
43-
Other
44-
~~~~~
45-
-
46-
-
41+
- Fixed bug in :meth:`.Styler.set_sticky` not handling index names correctly for single index columns case (:issue:`42537`)
42+
- Fixed bug in :meth:`DataFrame.copy` failing to consolidate blocks in the result (:issue:`42579`)
4743

4844
.. ---------------------------------------------------------------------------
4945
@@ -52,4 +48,4 @@ Other
5248
Contributors
5349
~~~~~~~~~~~~
5450

55-
.. contributors:: v1.3.0..v1.3.1|HEAD
51+
.. contributors:: v1.3.0..v1.3.1

doc/source/whatsnew/v1.3.2.rst

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
.. _whatsnew_132:
2+
3+
What's new in 1.3.2 (August ??, 2021)
4+
-------------------------------------
5+
6+
These are the changes in pandas 1.3.2. See :ref:`release` for a full changelog
7+
including other versions of pandas.
8+
9+
{{ header }}
10+
11+
.. ---------------------------------------------------------------------------
12+
13+
.. _whatsnew_132.regressions:
14+
15+
Fixed regressions
16+
~~~~~~~~~~~~~~~~~
17+
- Performance regression in :meth:`DataFrame.isin` and :meth:`Series.isin` for nullable data types (:issue:`42714`)
18+
- Regression in updating values of :class:`pandas.Series` using boolean index, created by using :meth:`pandas.DataFrame.pop` (:issue:`42530`)
19+
- Regression in :meth:`DataFrame.from_records` with empty records (:issue:`42456`)
20+
- Fixed regression in :meth:`DataFrame.shift` where TypeError occurred when shifting DataFrame created by concatenation of slices and fills with values (:issue:`42719`)
21+
- Regression in :meth:`DataFrame.agg` when the ``func`` argument returned lists and ``axis=1`` (:issue:`42727`)
22+
- Regression in :meth:`DataFrame.drop` does nothing if :class:`MultiIndex` has duplicates and indexer is a tuple or list of tuples (:issue:`42771`)
23+
- Fixed regression where :meth:`pandas.read_csv` raised a ``ValueError`` when parameters ``names`` and ``prefix`` were both set to None (:issue:`42387`)
24+
- Fixed regression in comparisons between :class:`Timestamp` object and ``datetime64`` objects outside the implementation bounds for nanosecond ``datetime64`` (:issue:`42794`)
25+
-
26+
27+
.. ---------------------------------------------------------------------------
28+
29+
.. _whatsnew_132.bug_fixes:
30+
31+
Bug fixes
32+
~~~~~~~~~
33+
- 1D slices over extension types turn into N-dimensional slices over ExtensionArrays (:issue:`42430`)
34+
-
35+
36+
.. ---------------------------------------------------------------------------
37+
38+
.. _whatsnew_132.other:
39+
40+
Other
41+
~~~~~
42+
-
43+
-
44+
45+
.. ---------------------------------------------------------------------------
46+
47+
.. _whatsnew_132.contributors:
48+
49+
Contributors
50+
~~~~~~~~~~~~
51+
52+
.. contributors:: v1.3.1..v1.3.2|HEAD

0 commit comments

Comments
 (0)