Skip to content

Commit 7e89b8d

Browse files
committed
Merge remote-tracking branch 'upstream/master' into windows_crlf
2 parents 3d13a4a + dbd102c commit 7e89b8d

33 files changed

+377
-184
lines changed

.travis.yml

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ matrix:
3535
language: generic
3636
env:
3737
- JOB="3.5, OSX" ENV_FILE="ci/travis-35-osx.yaml" TEST_ARGS="--skip-slow --skip-network"
38+
39+
- dist: trusty
40+
env:
41+
- JOB="3.7" ENV_FILE="ci/travis-37.yaml" TEST_ARGS="--skip-slow --skip-network"
42+
3843
- dist: trusty
3944
env:
4045
- JOB="2.7, locale, slow, old NumPy" ENV_FILE="ci/travis-27-locale.yaml" LOCALE_OVERRIDE="zh_CN.UTF-8" SLOW=true

ci/travis-37.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: pandas
2+
channels:
3+
- defaults
4+
- conda-forge
5+
- c3i_test
6+
dependencies:
7+
- python=3.7
8+
- cython
9+
- numpy
10+
- python-dateutil
11+
- nomkl
12+
- pytz
13+
- pytest
14+
- pytest-xdist

doc/source/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ For more information, see the `Python 3 statement`_ and the `Porting to Python 3
4343
Python version support
4444
----------------------
4545

46-
Officially Python 2.7, 3.5, and 3.6.
46+
Officially Python 2.7, 3.5, 3.6, and 3.7.
4747

4848
Installing pandas
4949
-----------------

doc/source/whatsnew/v0.11.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Numeric dtypes will propagate and can coexist in DataFrames. If a dtype is passe
7676
df1.dtypes
7777
df2 = DataFrame(dict( A = Series(randn(8),dtype='float16'),
7878
B = Series(randn(8)),
79-
C = Series(randn(8),dtype='uint8') ))
79+
C = Series(range(8),dtype='uint8') ))
8080
df2
8181
df2.dtypes
8282

doc/source/whatsnew/v0.23.2.txt

+37-5
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,46 @@ v0.23.2
66
This is a minor bug-fix release in the 0.23.x series and includes some small regression fixes
77
and bug fixes. We recommend that all users upgrade to this version.
88

9+
.. note::
10+
11+
Pandas 0.23.2 is first pandas release that's compatible with
12+
Python 3.7 (:issue:`20552`)
13+
14+
915
.. contents:: What's new in v0.23.2
1016
:local:
1117
:backlinks: none
1218

19+
.. _whatsnew_0232.enhancements:
20+
21+
Logical Reductions over Entire DataFrame
22+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23+
24+
:meth:`DataFrame.all` and :meth:`DataFrame.any` now accept ``axis=None`` to reduce over all axes to a scalar (:issue:`19976`)
25+
26+
.. ipython:: python
27+
28+
df = pd.DataFrame({"A": [1, 2], "B": [True, False]})
29+
df.all(axis=None)
30+
31+
32+
This also provides compatibility with NumPy 1.15, which now dispatches to ``DataFrame.all``.
33+
With NumPy 1.15 and pandas 0.23.1 or earlier, :func:`numpy.all` will no longer reduce over every axis:
34+
35+
.. code-block:: python
36+
37+
>>> # NumPy 1.15, pandas 0.23.1
38+
>>> np.any(pd.DataFrame({"A": [False], "B": [False]}))
39+
A False
40+
B False
41+
dtype: bool
42+
43+
With pandas 0.23.2, that will correctly return False, as it did with NumPy < 1.15.
44+
45+
.. ipython:: python
46+
47+
np.any(pd.DataFrame({"A": [False], "B": [False]}))
48+
1349

1450
.. _whatsnew_0232.fixed_regressions:
1551

@@ -93,11 +129,7 @@ Bug Fixes
93129

94130
- Bug in :class:`Timestamp` and :class:`DatetimeIndex` where passing a :class:`Timestamp` localized after a DST transition would return a datetime before the DST transition (:issue:`20854`)
95131
- Bug in comparing :class:`DataFrame`s with tz-aware :class:`DatetimeIndex` columns with a DST transition that raised a ``KeyError`` (:issue:`19970`)
96-
- Bug in :meth:`DatetimeIndex.shift` where an ``AssertionError`` would raise when shifting across DST (:issue:`8616`)
97-
- Bug in :class:`Timestamp` constructor where passing an invalid timezone offset designator (``Z``) would not raise a ``ValueError``(:issue:`8910`)
98-
- Bug in :meth:`Timestamp.replace` where replacing at a DST boundary would retain an incorrect offset (:issue:`7825`)
99-
- Bug in :meth:`DatetimeIndex.reindex` when reindexing a tz-naive and tz-aware :class:`DatetimeIndex` (:issue:`8306`)
100-
- Bug in :meth:`DatetimeIndex.resample` when downsampling across a DST boundary (:issue:`8531`)
132+
101133

102134
**Other**
103135

doc/source/whatsnew/v0.24.0.txt

+8-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Other Enhancements
1717
- :func:`to_datetime` now supports the ``%Z`` and ``%z`` directive when passed into ``format`` (:issue:`13486`)
1818
- :func:`Series.mode` and :func:`DataFrame.mode` now support the ``dropna`` parameter which can be used to specify whether NaN/NaT values should be considered (:issue:`17534`)
1919
- :func:`to_csv` now supports ``compression`` keyword when a file handle is passed. (:issue:`21227`)
20-
- :meth:`Index.droplevel` is now implemented also for flat indexes, for compatibility with MultiIndex (:issue:`21115`)
20+
- :meth:`Index.droplevel` is now implemented also for flat indexes, for compatibility with :class:`MultiIndex` (:issue:`21115`)
2121

2222

2323
.. _whatsnew_0240.api_breaking:
@@ -112,7 +112,7 @@ Deprecations
112112
~~~~~~~~~~~~
113113

114114
- :meth:`DataFrame.to_stata`, :meth:`read_stata`, :class:`StataReader` and :class:`StataWriter` have deprecated the ``encoding`` argument. The encoding of a Stata dta file is determined by the file type and cannot be changed (:issue:`21244`).
115-
-
115+
- :meth:`MultiIndex.to_hierarchical` is deprecated and will be removed in a future version (:issue:`21613`)
116116
-
117117

118118
.. _whatsnew_0240.prior_deprecations:
@@ -161,7 +161,11 @@ Datetimelike
161161

162162
- Fixed bug where two :class:`DateOffset` objects with different ``normalize`` attributes could evaluate as equal (:issue:`21404`)
163163
- Bug in :class:`Index` with ``datetime64[ns, tz]`` dtype that did not localize integer data correctly (:issue:`20964`)
164-
-
164+
- Bug in :meth:`DatetimeIndex.shift` where an ``AssertionError`` would raise when shifting across DST (:issue:`8616`)
165+
- Bug in :class:`Timestamp` constructor where passing an invalid timezone offset designator (``Z``) would not raise a ``ValueError``(:issue:`8910`)
166+
- Bug in :meth:`Timestamp.replace` where replacing at a DST boundary would retain an incorrect offset (:issue:`7825`)
167+
- Bug in :meth:`DatetimeIndex.reindex` when reindexing a tz-naive and tz-aware :class:`DatetimeIndex` (:issue:`8306`)
168+
- Bug in :meth:`DatetimeIndex.resample` when downsampling across a DST boundary (:issue:`8531`)
165169

166170
Timedelta
167171
^^^^^^^^^
@@ -201,6 +205,7 @@ Indexing
201205
^^^^^^^^
202206

203207
- The traceback from a ``KeyError`` when asking ``.loc`` for a single missing label is now shorter and more clear (:issue:`21557`)
208+
- When ``.ix`` is asked for a missing integer label in a :class:`MultiIndex` with a first level of integer type, it now raises a ``KeyError`` - consistently with the case of a flat :class:`Int64Index` - rather than falling back to positional indexing (:issue:`21593`)
204209
-
205210
-
206211

pandas/_libs/hashtable_class_helper.pxi.in

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ Template for each `dtype` helper function for hashtable
44
WARNING: DO NOT edit .pxi FILE directly, .pxi is generated from .pxi.in
55
"""
66

7-
from missing cimport is_null_datetimelike
8-
97

108
#----------------------------------------------------------------------
119
# VectorData

pandas/compat/__init__.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@
4040
from collections import namedtuple
4141

4242
PY2 = sys.version_info[0] == 2
43-
PY3 = (sys.version_info[0] >= 3)
44-
PY35 = (sys.version_info >= (3, 5))
45-
PY36 = (sys.version_info >= (3, 6))
46-
PYPY = (platform.python_implementation() == 'PyPy')
43+
PY3 = sys.version_info[0] >= 3
44+
PY35 = sys.version_info >= (3, 5)
45+
PY36 = sys.version_info >= (3, 6)
46+
PY37 = sys.version_info >= (3, 7)
47+
PYPY = platform.python_implementation() == 'PyPy'
4748

4849
try:
4950
import __builtin__ as builtins

pandas/core/frame.py

+19-5
Original file line numberDiff line numberDiff line change
@@ -4676,7 +4676,7 @@ def swaplevel(self, i=-2, j=-1, axis=0):
46764676
46774677
Returns
46784678
-------
4679-
swapped : type of caller (new object)
4679+
swapped : same type as caller (new object)
46804680
46814681
.. versionchanged:: 0.18.1
46824682
@@ -6847,13 +6847,18 @@ def _count_level(self, level, axis=0, numeric_only=False):
68476847

68486848
def _reduce(self, op, name, axis=0, skipna=True, numeric_only=None,
68496849
filter_type=None, **kwds):
6850-
axis = self._get_axis_number(axis)
6850+
if axis is None and filter_type == 'bool':
6851+
labels = None
6852+
constructor = None
6853+
else:
6854+
# TODO: Make other agg func handle axis=None properly
6855+
axis = self._get_axis_number(axis)
6856+
labels = self._get_agg_axis(axis)
6857+
constructor = self._constructor
68516858

68526859
def f(x):
68536860
return op(x, axis=axis, skipna=skipna, **kwds)
68546861

6855-
labels = self._get_agg_axis(axis)
6856-
68576862
# exclude timedelta/datetime unless we are uniform types
68586863
if axis == 1 and self._is_mixed_type and self._is_datelike_mixed_type:
68596864
numeric_only = True
@@ -6862,6 +6867,13 @@ def f(x):
68626867
try:
68636868
values = self.values
68646869
result = f(values)
6870+
6871+
if (filter_type == 'bool' and is_object_dtype(values) and
6872+
axis is None):
6873+
# work around https://github.com/numpy/numpy/issues/10489
6874+
# TODO: combine with hasattr(result, 'dtype') further down
6875+
# hard since we don't have `values` down there.
6876+
result = np.bool_(result)
68656877
except Exception as e:
68666878

68676879
# try by-column first
@@ -6928,7 +6940,9 @@ def f(x):
69286940
if axis == 0:
69296941
result = coerce_to_dtypes(result, self.dtypes)
69306942

6931-
return Series(result, index=labels)
6943+
if constructor is not None:
6944+
result = Series(result, index=labels)
6945+
return result
69326946

69336947
def nunique(self, axis=0, dropna=True):
69346948
"""

0 commit comments

Comments
 (0)