Skip to content

Commit 6991394

Browse files
Daniel SaxtonDaniel Saxton
Daniel Saxton
authored and
Daniel Saxton
committed
Merge branch 'master' into bool-idx
2 parents ad7ae66 + 27f365d commit 6991394

File tree

110 files changed

+3600
-3360
lines changed

Some content is hidden

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

110 files changed

+3600
-3360
lines changed

README.md

Lines changed: 10 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -5,82 +5,16 @@
55
-----------------
66

77
# pandas: powerful Python data analysis toolkit
8-
9-
<table>
10-
<tr>
11-
<td>Latest Release</td>
12-
<td>
13-
<a href="https://pypi.org/project/pandas/">
14-
<img src="https://img.shields.io/pypi/v/pandas.svg" alt="latest release" />
15-
</a>
16-
</td>
17-
</tr>
18-
<td></td>
19-
<td>
20-
<a href="https://anaconda.org/anaconda/pandas/">
21-
<img src="https://anaconda.org/conda-forge/pandas/badges/version.svg" alt="latest release" />
22-
</a>
23-
</td>
24-
</tr>
25-
<tr>
26-
<td>Package Status</td>
27-
<td>
28-
<a href="https://pypi.org/project/pandas/">
29-
<img src="https://img.shields.io/pypi/status/pandas.svg" alt="status" />
30-
</a>
31-
</td>
32-
</tr>
33-
<tr>
34-
<td>License</td>
35-
<td>
36-
<a href="https://github.com/pandas-dev/pandas/blob/master/LICENSE">
37-
<img src="https://img.shields.io/pypi/l/pandas.svg" alt="license" />
38-
</a>
39-
</td>
40-
</tr>
41-
<tr>
42-
<td>Build Status</td>
43-
<td>
44-
<a href="https://travis-ci.org/pandas-dev/pandas">
45-
<img src="https://travis-ci.org/pandas-dev/pandas.svg?branch=master" alt="travis build status" />
46-
</a>
47-
</td>
48-
</tr>
49-
<tr>
50-
<td></td>
51-
<td>
52-
<a href="https://dev.azure.com/pandas-dev/pandas/_build/latest?definitionId=1&branch=master">
53-
<img src="https://dev.azure.com/pandas-dev/pandas/_apis/build/status/pandas-dev.pandas?branch=master" alt="Azure Pipelines build status" />
54-
</a>
55-
</td>
56-
</tr>
57-
<tr>
58-
<td>Coverage</td>
59-
 <td>
60-
<a href="https://codecov.io/gh/pandas-dev/pandas">
61-
<img src="https://codecov.io/github/pandas-dev/pandas/coverage.svg?branch=master" alt="coverage" />
62-
</a>
63-
</td>
64-
</tr>
65-
<tr>
66-
<td>Downloads</td>
67-
<td>
68-
<a href="https://pandas.pydata.org">
69-
<img src="https://anaconda.org/conda-forge/pandas/badges/downloads.svg" alt="conda-forge downloads" />
70-
</a>
71-
</td>
72-
</tr>
73-
<tr>
74-
<td>Gitter</td>
75-
<td>
76-
<a href="https://gitter.im/pydata/pandas">
77-
<img src="https://badges.gitter.im/Join%20Chat.svg" />
78-
</a>
79-
</td>
80-
</tr>
81-
</table>
82-
83-
8+
[![PyPI Latest Release](https://img.shields.io/pypi/v/pandas.svg)](https://pypi.org/project/pandas/)
9+
[![Conda Latest Release](https://anaconda.org/conda-forge/pandas/badges/version.svg)](https://anaconda.org/anaconda/pandas/)
10+
[![Package Status](https://img.shields.io/pypi/status/pandas.svg)](https://pypi.org/project/pandas/)
11+
[![License](https://img.shields.io/pypi/l/pandas.svg)](https://github.com/pandas-dev/pandas/blob/master/LICENSE)
12+
[![Travis Build Status](https://travis-ci.org/pandas-dev/pandas.svg?branch=master)](https://travis-ci.org/pandas-dev/pandas)
13+
[![Azure Build Status](https://dev.azure.com/pandas-dev/pandas/_apis/build/status/pandas-dev.pandas?branch=master)](https://dev.azure.com/pandas-dev/pandas/_build/latest?definitionId=1&branch=master)
14+
[![Coverage](https://codecov.io/github/pandas-dev/pandas/coverage.svg?branch=master)](https://codecov.io/gh/pandas-dev/pandas)
15+
[![Downloads](https://anaconda.org/conda-forge/pandas/badges/downloads.svg)](https://pandas.pydata.org)
16+
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/pydata/pandas)
17+
[![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org)
8418

8519
## What is it?
8620

ci/deps/travis-36-cov.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ dependencies:
2727
- numexpr
2828
- numpy=1.15.*
2929
- odfpy
30-
- openpyxl<=3.0.1
31-
# https://github.com/pandas-dev/pandas/pull/30009 openpyxl 3.0.2 broke
30+
- openpyxl
3231
- pandas-gbq
3332
- psycopg2
3433
- pyarrow>=0.13.0

doc/source/whatsnew/v1.0.1.rst

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@ including other versions of pandas.
1010

1111
.. ---------------------------------------------------------------------------
1212
13+
.. _whatsnew_101.deprecations:
14+
15+
Deprecations
16+
~~~~~~~~~~~~
17+
18+
- Support for negative integer for :attr:`pd.options.display.max_colwidth` is deprecated in favor of using ``None`` (:issue:`31532`)
19+
20+
.. ---------------------------------------------------------------------------
1321
1422
.. _whatsnew_101.bug_fixes:
1523

1624
Bug fixes
1725
~~~~~~~~~
18-
26+
- Bug in :meth:`GroupBy.apply` was raising ``TypeError`` if called with function which returned a non-pandas non-scalar object (e.g. a list) (:issue:`31441`)
1927

2028
Categorical
2129
^^^^^^^^^^^
@@ -25,8 +33,8 @@ Categorical
2533

2634
Datetimelike
2735
^^^^^^^^^^^^
28-
-
29-
-
36+
- Fixed regression in :meth:`to_datetime` when parsing non-nanosecond resolution datetimes (:issue:`31491`)
37+
- Fixed bug in :meth:`to_datetime` raising when ``cache=True`` and out-of-bound values are present (:issue:`31491`)
3038

3139
Timedelta
3240
^^^^^^^^^
@@ -44,6 +52,7 @@ Timezones
4452
Numeric
4553
^^^^^^^
4654
- Bug in dtypes being lost in ``DataFrame.__invert__`` (``~`` operator) with mixed dtypes (:issue:`31183`)
55+
- Bug in :class:`Series` multiplication when multiplying a numeric :class:`Series` with >10000 elements with a timedelta-like scalar (:issue:`31467`)
4756
-
4857

4958
Conversion
@@ -68,8 +77,11 @@ Interval
6877
Indexing
6978
^^^^^^^^
7079

80+
- Fixed regression when indexing a ``Series`` or ``DataFrame`` indexed by ``DatetimeIndex`` with a slice containg a :class:`datetime.date` (:issue:`31501`)
81+
- Fixed regression in :class:`DataFrame` setting values with a slice (e.g. ``df[-4:] = 1``) indexing by label instead of position (:issue:`31469`)
7182
-
7283
-
84+
- Bug where assigning to a :class:`Series` using a IntegerArray / BooleanArray as a mask would raise ``TypeError`` (:issue:`31446`)
7385

7486
Missing
7587
^^^^^^^
@@ -86,6 +98,7 @@ MultiIndex
8698
I/O
8799
^^^
88100

101+
- Fixed regression in :meth:`~DataFrame.to_csv` where specifying an ``na_rep`` might truncate the values written (:issue:`31447`)
89102
-
90103
-
91104

@@ -118,12 +131,14 @@ ExtensionArray
118131
^^^^^^^^^^^^^^
119132

120133
- Bug in dtype being lost in ``__invert__`` (``~`` operator) for extension-array backed ``Series`` and ``DataFrame`` (:issue:`23087`)
134+
- Bug where :meth:`qcut` would raise when passed a nullable integer. (:issue:`31389`)
121135
-
122136

123137

124138
Other
125139
^^^^^
126-
-
140+
- Regression fixed in objTOJSON.c fix return-type warning (:issue:`31463`)
141+
- Fixed a regression where setting :attr:`pd.options.display.max_colwidth` was not accepting negative integer. In addition, this behavior has been deprecated in favor of using ``None`` (:issue:`31532`)
127142
-
128143

129144
.. ---------------------------------------------------------------------------

doc/source/whatsnew/v1.1.0.rst

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ Backwards incompatible API changes
6060
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6161
- :meth:`DataFrame.swaplevels` now raises a ``TypeError`` if the axis is not a :class:`MultiIndex`.
6262
Previously a ``AttributeError`` was raised (:issue:`31126`)
63+
- :meth:`DataFrameGroupby.mean` and :meth:`SeriesGroupby.mean` (and similarly for :meth:`~DataFrameGroupby.median`, :meth:`~DataFrameGroupby.std`` and :meth:`~DataFrameGroupby.var``)
64+
now raise a ``TypeError`` if a not-accepted keyword argument is passed into it.
65+
Previously a ``UnsupportedFunctionCall`` was raised (``AssertionError`` if ``min_count`` passed into :meth:`~DataFrameGroupby.median``) (:issue:`31485`)
6366

6467

6568
.. ---------------------------------------------------------------------------
@@ -109,7 +112,7 @@ Datetimelike
109112
Timedelta
110113
^^^^^^^^^
111114

112-
-
115+
- Bug in constructing a :class:`Timedelta` with a high precision integer that would round the :class:`Timedelta` components (:issue:`31354`)
113116
-
114117

115118
Timezones
@@ -150,6 +153,7 @@ Indexing
150153
- Bug in :meth:`PeriodIndex.get_loc` treating higher-resolution strings differently from :meth:`PeriodIndex.get_value` (:issue:`31172`)
151154
- Bug in :meth:`Series.at` and :meth:`DataFrame.at` not matching ``.loc`` behavior when looking up an integer in a :class:`Float64Index` (:issue:`31329`)
152155
- Bug in :meth:`PeriodIndex.is_monotonic` incorrectly returning ``True`` when containing leading ``NaT`` entries (:issue:`31437`)
156+
- Bug in :meth:`DatetimeIndex.get_loc` raising ``KeyError`` with converted-integer key instead of the user-passed key (:issue:`31425`)
153157
-
154158

155159
Missing
@@ -160,14 +164,20 @@ Missing
160164

161165
MultiIndex
162166
^^^^^^^^^^
167+
- Bug in :meth:`Dataframe.loc` when used with a :class:`MultiIndex`. The returned values were not in the same order as the given inputs (:issue:`22797`)
163168

164-
-
169+
.. ipython:: python
170+
171+
df = pd.DataFrame(np.arange(4),
172+
index=[["a", "a", "b", "b"], [1, 2, 1, 2]])
173+
# Rows are now ordered as the requested keys
174+
df.loc[(['b', 'a'], [2, 1]), :]
165175
-
166176

167177
I/O
168178
^^^
169179
- Bug in :meth:`read_json` where integer overflow was occuring when json contains big number strings. (:issue:`30320`)
170-
-
180+
- Bug in :meth:`DataFrame.to_json` was raising ``NotFoundError`` when ``path_or_buf`` was an S3 URI (:issue:`28375`)
171181
-
172182

173183
Plotting
@@ -211,7 +221,7 @@ Other
211221
^^^^^
212222
- Appending a dictionary to a :class:`DataFrame` without passing ``ignore_index=True`` will raise ``TypeError: Can only append a dict if ignore_index=True``
213223
instead of ``TypeError: Can only append a Series if ignore_index=True or if the Series has a name`` (:issue:`30871`)
214-
-
224+
- Set operations on an object-dtype :class:`Index` now always return object-dtype results (:issue:`31401`)
215225

216226
.. ---------------------------------------------------------------------------
217227

pandas/_libs/index.pyx

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,6 @@ cdef class IndexEngine:
8787
else:
8888
return get_value_at(arr, loc, tz=tz)
8989

90-
cpdef set_value(self, ndarray arr, object key, object value):
91-
"""
92-
Parameters
93-
----------
94-
arr : 1-dimensional ndarray
95-
"""
96-
cdef:
97-
object loc
98-
99-
loc = self.get_loc(key)
100-
value = convert_scalar(arr, value)
101-
102-
arr[loc] = value
103-
10490
cpdef get_loc(self, object val):
10591
cdef:
10692
Py_ssize_t loc
@@ -585,16 +571,23 @@ cpdef convert_scalar(ndarray arr, object value):
585571
raise ValueError("cannot set a Timedelta with a non-timedelta "
586572
f"{type(value).__name__}")
587573

588-
if (issubclass(arr.dtype.type, (np.integer, np.floating, np.complex)) and
589-
not issubclass(arr.dtype.type, np.bool_)):
590-
if util.is_bool_object(value):
591-
raise ValueError("Cannot assign bool to float/integer series")
574+
else:
575+
validate_numeric_casting(arr.dtype, value)
576+
577+
return value
578+
592579

593-
if issubclass(arr.dtype.type, (np.integer, np.bool_)):
580+
cpdef validate_numeric_casting(dtype, object value):
581+
# Note: we can't annotate dtype as cnp.dtype because that cases dtype.type
582+
# to integer
583+
if issubclass(dtype.type, (np.integer, np.bool_)):
594584
if util.is_float_object(value) and value != value:
595585
raise ValueError("Cannot assign nan to integer series")
596586

597-
return value
587+
if (issubclass(dtype.type, (np.integer, np.floating, np.complex)) and
588+
not issubclass(dtype.type, np.bool_)):
589+
if util.is_bool_object(value):
590+
raise ValueError("Cannot assign bool to float/integer series")
598591

599592

600593
cdef class BaseMultiIndexCodesEngine:

pandas/_libs/reduction.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,9 @@ def apply_frame_axis0(object frame, object f, object names,
501501

502502
if not is_scalar(piece):
503503
# Need to copy data to avoid appending references
504-
if hasattr(piece, "copy"):
504+
try:
505505
piece = piece.copy(deep="all")
506-
else:
506+
except (TypeError, AttributeError):
507507
piece = copy(piece)
508508

509509
results.append(piece)

0 commit comments

Comments
 (0)