Skip to content

Commit d765e24

Browse files
committed
Merge branch 'master' of https://github.com/pandas-dev/pandas into libmore
2 parents 89e0053 + b9e2278 commit d765e24

File tree

242 files changed

+1986
-2546
lines changed

Some content is hidden

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

242 files changed

+1986
-2546
lines changed

ci/travis-27.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ dependencies:
3535
- s3fs
3636
- scipy
3737
- sqlalchemy=0.9.6
38-
- xarray=0.8.0
38+
- xarray=0.9.6
3939
- xlrd=0.9.2
4040
- xlsxwriter=0.5.2
4141
- xlwt=0.7.5

doc/source/api.rst

-1
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,6 @@ Reshaping, sorting
515515
Series.repeat
516516
Series.squeeze
517517
Series.view
518-
Series.sortlevel
519518

520519

521520
Combining / joining / merging

doc/source/whatsnew/v0.24.0.txt

+16-3
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ Other Enhancements
201201
- :func:`~DataFrame.to_csv`, :func:`~Series.to_csv`, :func:`~DataFrame.to_json`, and :func:`~Series.to_json` now support ``compression='infer'`` to infer compression based on filename extension (:issue:`15008`).
202202
The default compression for ``to_csv``, ``to_json``, and ``to_pickle`` methods has been updated to ``'infer'`` (:issue:`22004`).
203203
- :func:`to_timedelta` now supports iso-formated timedelta strings (:issue:`21877`)
204-
- Comparing :class:`Timedelta` with unknown types now return ``NotImplemented`` instead of ``False`` (:issue:`20829`)
205204
- :class:`Series` and :class:`DataFrame` now support :class:`Iterable` in constructor (:issue:`2193`)
206205
- :class:`DatetimeIndex` gained :attr:`DatetimeIndex.timetz` attribute. Returns local time with timezone information. (:issue:`21358`)
207206
- :meth:`round`, :meth:`ceil`, and meth:`floor` for :class:`DatetimeIndex` and :class:`Timestamp` now support an ``ambiguous`` argument for handling datetimes that are rounded to ambiguous times (:issue:`18946`)
@@ -910,6 +909,7 @@ Other API Changes
910909
has an improved ``KeyError`` message, and will not fail on duplicate column names with ``drop=True``. (:issue:`22484`)
911910
- Slicing a single row of a DataFrame with multiple ExtensionArrays of the same type now preserves the dtype, rather than coercing to object (:issue:`22784`)
912911
- :class:`DateOffset` attribute `_cacheable` and method `_should_cache` have been removed (:issue:`23118`)
912+
- Comparing :class:`Timedelta` to be less or greater than unknown types now raises a ``TypeError`` instead of returning ``False`` (:issue:`20829`)
913913
- :meth:`Index.hasnans` and :meth:`Series.hasnans` now always return a python boolean. Previously, a python or a numpy boolean could be returned, depending on circumstances (:issue:`23294`).
914914

915915
.. _whatsnew_0240.deprecations:
@@ -942,13 +942,22 @@ Removal of prior version deprecations/changes
942942
- Removal of the previously deprecated module ``pandas.core.datetools`` (:issue:`14105`, :issue:`14094`)
943943
- Strings passed into :meth:`DataFrame.groupby` that refer to both column and index levels will raise a ``ValueError`` (:issue:`14432`)
944944
- :meth:`Index.repeat` and :meth:`MultiIndex.repeat` have renamed the ``n`` argument to ``repeats`` (:issue:`14645`)
945+
- The ``Series`` constructor and ``.astype`` method will now raise a ``ValueError`` if timestamp dtypes are passed in without a frequency (e.g. ``np.datetime64``) for the ``dtype`` parameter (:issue:`15987`)
945946
- Removal of the previously deprecated ``as_indexer`` keyword completely from ``str.match()`` (:issue:`22356`, :issue:`6581`)
947+
- The modules ``pandas.types``, ``pandas.computation``, and ``pandas.util.decorators`` have been removed (:issue:`16157`, :issue:`16250`)
946948
- Removed the ``pandas.formats.style`` shim for :class:`pandas.io.formats.style.Styler` (:issue:`16059`)
949+
- :func:`pandas.pnow`, :func:`pandas.match`, :func:`pandas.groupby`, :func:`pd.get_store`, ``pd.Expr``, and ``pd.Term`` have been removed (:issue:`15538`, :issue:`15940`)
947950
- :meth:`Categorical.searchsorted` and :meth:`Series.searchsorted` have renamed the ``v`` argument to ``value`` (:issue:`14645`)
951+
- ``pandas.parser``, ``pandas.lib``, and ``pandas.tslib`` have been removed (:issue:`15537`)
948952
- :meth:`TimedeltaIndex.searchsorted`, :meth:`DatetimeIndex.searchsorted`, and :meth:`PeriodIndex.searchsorted` have renamed the ``key`` argument to ``value`` (:issue:`14645`)
953+
- :meth:`DataFrame.consolidate` and :meth:`Series.consolidate` have been removed (:issue:`15501`)
949954
- Removal of the previously deprecated module ``pandas.json`` (:issue:`19944`)
955+
- The module ``pandas.tools`` has been removed (:issue:`15358`, :issue:`16005`)
950956
- :meth:`SparseArray.get_values` and :meth:`SparseArray.to_dense` have dropped the ``fill`` parameter (:issue:`14686`)
957+
- :meth:`DataFrame.sortlevel` and :meth:`Series.sortlevel` have been removed (:issue:`15099`)
951958
- :meth:`SparseSeries.to_dense` has dropped the ``sparse_only`` parameter (:issue:`14686`)
959+
- :meth:`DataFrame.astype` and :meth:`Series.astype` have renamed the ``raise_on_error`` argument to ``errors`` (:issue:`14967`)
960+
- ``is_sequence``, ``is_any_int_dtype``, and ``is_floating_dtype`` have been removed from ``pandas.api.types`` (:issue:`16163`, :issue:`16189`)
952961

953962
.. _whatsnew_0240.performance:
954963

@@ -1022,6 +1031,8 @@ Datetimelike
10221031
- Bug in :class:`PeriodIndex` where adding or subtracting a :class:`timedelta` or :class:`Tick` object produced incorrect results (:issue:`22988`)
10231032
- Bug in :func:`date_range` when decrementing a start date to a past end date by a negative frequency (:issue:`23270`)
10241033
- Bug in :func:`DataFrame.combine` with datetimelike values raising a TypeError (:issue:`23079`)
1034+
- Bug in :func:`date_range` with frequency of ``Day`` or higher where dates sufficiently far in the future could wrap around to the past instead of raising ``OutOfBoundsDatetime`` (:issue:`14187`)
1035+
- Bug in :class:`PeriodIndex` with attribute ``freq.n`` greater than 1 where adding a :class:`DateOffset` object would return incorrect results (:issue:`23215`)
10251036

10261037
Timedelta
10271038
^^^^^^^^^
@@ -1033,7 +1044,8 @@ Timedelta
10331044
- Bug in :class:`TimedeltaIndex` incorrectly allowing indexing with ``Timestamp`` object (:issue:`20464`)
10341045
- Fixed bug where subtracting :class:`Timedelta` from an object-dtyped array would raise ``TypeError`` (:issue:`21980`)
10351046
- Fixed bug in adding a :class:`DataFrame` with all-`timedelta64[ns]` dtypes to a :class:`DataFrame` with all-integer dtypes returning incorrect results instead of raising ``TypeError`` (:issue:`22696`)
1036-
1047+
- Bug in :class:`TimedeltaIndex` where adding a timezone-aware datetime scalar incorrectly returned a timezone-naive :class:`DatetimeIndex` (:issue:`23215`)
1048+
- Bug in :class:`TimedeltaIndex` where adding ``np.timedelta64('NaT')`` incorrectly returned an all-`NaT` :class:`DatetimeIndex` instead of an all-`NaT` :class:`TimedeltaIndex` (:issue:`23215`)
10371049

10381050
Timezones
10391051
^^^^^^^^^
@@ -1063,7 +1075,7 @@ Offsets
10631075

10641076
- Bug in :class:`FY5253` where date offsets could incorrectly raise an ``AssertionError`` in arithmetic operatons (:issue:`14774`)
10651077
- Bug in :class:`DateOffset` where keyword arguments ``week`` and ``milliseconds`` were accepted and ignored. Passing these will now raise ``ValueError`` (:issue:`19398`)
1066-
-
1078+
- Bug in adding :class:`DateOffset` with :class:`DataFrame` or :class:`PeriodIndex` incorrectly raising ``TypeError`` (:issue:`23215`)
10671079

10681080
Numeric
10691081
^^^^^^^
@@ -1080,6 +1092,7 @@ Numeric
10801092
- Bug in :meth:`DataFrame.astype` to extension dtype may raise ``AttributeError`` (:issue:`22578`)
10811093
- Bug in :class:`DataFrame` with ``timedelta64[ns]`` dtype arithmetic operations with ``ndarray`` with integer dtype incorrectly treating the narray as ``timedelta64[ns]`` dtype (:issue:`23114`)
10821094
- Bug in :meth:`Series.rpow` with object dtype ``NaN`` for ``1 ** NA`` instead of ``1`` (:issue:`22922`).
1095+
- :meth:`Series.agg` can now handle numpy NaN-aware methods like :func:`numpy.nansum` (:issue:`19629`)
10831096

10841097
Strings
10851098
^^^^^^^

pandas/__init__.py

-26
Original file line numberDiff line numberDiff line change
@@ -45,37 +45,11 @@
4545
from pandas.core.computation.api import *
4646
from pandas.core.reshape.api import *
4747

48-
# deprecate tools.plotting, plot_params and scatter_matrix on the top namespace
49-
import pandas.tools.plotting
50-
plot_params = pandas.plotting._style._Options(deprecated=True)
51-
# do not import deprecate to top namespace
52-
scatter_matrix = pandas.util._decorators.deprecate(
53-
'pandas.scatter_matrix', pandas.plotting.scatter_matrix, '0.20.0',
54-
'pandas.plotting.scatter_matrix')
55-
5648
from pandas.util._print_versions import show_versions
5749
from pandas.io.api import *
5850
from pandas.util._tester import test
5951
import pandas.testing
6052

61-
# extension module deprecations
62-
from pandas.util._depr_module import _DeprecatedModule
63-
64-
parser = _DeprecatedModule(deprmod='pandas.parser',
65-
removals=['na_values'],
66-
moved={'CParserError': 'pandas.errors.ParserError'})
67-
lib = _DeprecatedModule(deprmod='pandas.lib', deprmodto=False,
68-
moved={'Timestamp': 'pandas.Timestamp',
69-
'Timedelta': 'pandas.Timedelta',
70-
'NaT': 'pandas.NaT',
71-
'infer_dtype': 'pandas.api.types.infer_dtype'})
72-
tslib = _DeprecatedModule(deprmod='pandas.tslib',
73-
moved={'Timestamp': 'pandas.Timestamp',
74-
'Timedelta': 'pandas.Timedelta',
75-
'NaT': 'pandas.NaT',
76-
'NaTType': 'type(pandas.NaT)',
77-
'OutOfBoundsDatetime': 'pandas.errors.OutOfBoundsDatetime'})
78-
7953
# use the closest tagged version if possible
8054
from ._version import get_versions
8155
v = get_versions()

pandas/_libs/tslibs/offsets.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,8 @@ class _BaseOffset(object):
344344
return {name: kwds[name] for name in kwds if kwds[name] is not None}
345345

346346
def __add__(self, other):
347-
if getattr(other, "_typ", None) in ["datetimeindex",
348-
"series", "period"]:
347+
if getattr(other, "_typ", None) in ["datetimeindex", "periodindex",
348+
"series", "period", "dataframe"]:
349349
# defer to the other class's implementation
350350
return other + self
351351
try:

pandas/_libs/tslibs/timedeltas.pyx

+12
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,12 @@ class Timedelta(_Timedelta):
12131213
return other.delta * self
12141214
return NotImplemented
12151215

1216+
elif util.is_nan(other):
1217+
# i.e. np.nan, but also catch np.float64("NaN") which would
1218+
# otherwise get caught by the hasattr(other, "dtype") branch
1219+
# incorrectly return a np.timedelta64 object.
1220+
return NaT
1221+
12161222
elif hasattr(other, 'dtype'):
12171223
# ndarray-like
12181224
return other * self.to_timedelta64()
@@ -1240,6 +1246,12 @@ class Timedelta(_Timedelta):
12401246
# convert to Timedelta below
12411247
pass
12421248

1249+
elif util.is_nan(other):
1250+
# i.e. np.nan, but also catch np.float64("NaN") which would
1251+
# otherwise get caught by the hasattr(other, "dtype") branch
1252+
# incorrectly return a np.timedelta64 object.
1253+
return NaT
1254+
12431255
elif hasattr(other, 'dtype'):
12441256
return self.to_timedelta64() / other
12451257

pandas/computation/__init__.py

Whitespace-only changes.

pandas/computation/expressions.py

-15
This file was deleted.

pandas/core/api.py

+1-22
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
MultiIndex, IntervalIndex,
1515
TimedeltaIndex, DatetimeIndex,
1616
PeriodIndex, NaT)
17-
from pandas.core.indexes.period import Period, period_range, pnow
17+
from pandas.core.indexes.period import Period, period_range
1818
from pandas.core.indexes.timedeltas import Timedelta, timedelta_range
1919
from pandas.core.indexes.datetimes import Timestamp, date_range, bdate_range
2020
from pandas.core.indexes.interval import Interval, interval_range
@@ -36,27 +36,6 @@
3636
describe_option, option_context, options)
3737

3838

39-
# deprecation, xref #13790
40-
def match(*args, **kwargs):
41-
42-
import warnings
43-
warnings.warn("pd.match() is deprecated and will be removed "
44-
"in a future version",
45-
FutureWarning, stacklevel=2)
46-
from pandas.core.algorithms import match
47-
return match(*args, **kwargs)
48-
49-
50-
def groupby(*args, **kwargs):
51-
import warnings
52-
53-
warnings.warn("pd.groupby() is deprecated and will be removed; "
54-
"Please use the Series.groupby() or "
55-
"DataFrame.groupby() methods",
56-
FutureWarning, stacklevel=2)
57-
return args[0].groupby(*args[1:], **kwargs)
58-
59-
6039
# Deprecation: xref gh-16747
6140
class TimeGrouper(object):
6241

0 commit comments

Comments
 (0)