From 1bdde217655806188c771bf8eb9f4738985480bd Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Sat, 7 Jul 2018 17:54:37 -0500 Subject: [PATCH] DOC: Bunch o warnings --- doc/source/extending.rst | 4 ++-- doc/source/text.rst | 2 +- doc/source/whatsnew/v0.23.0.txt | 2 +- doc/source/whatsnew/v0.24.0.txt | 11 ++--------- pandas/core/frame.py | 9 ++++++--- pandas/core/indexes/datetimes.py | 7 +++++-- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/doc/source/extending.rst b/doc/source/extending.rst index dcabfed2b6021..9422434a1d998 100644 --- a/doc/source/extending.rst +++ b/doc/source/extending.rst @@ -80,7 +80,7 @@ on :ref:`ecosystem.extensions`. The interface consists of two classes. :class:`~pandas.api.extensions.ExtensionDtype` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A :class:`pandas.api.extensions.ExtensionDtype` is similar to a ``numpy.dtype`` object. It describes the data type. Implementors are responsible for a few unique items like the name. @@ -124,7 +124,7 @@ and comments contain guidance for properly implementing the interface. .. _extending.extension.operator: :class:`~pandas.api.extensions.ExtensionArray` Operator Support -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. versionadded:: 0.24.0 diff --git a/doc/source/text.rst b/doc/source/text.rst index dde82e3c19f82..0081b592f91bf 100644 --- a/doc/source/text.rst +++ b/doc/source/text.rst @@ -312,7 +312,7 @@ All one-dimensional list-likes can be arbitrarily combined in a list-like contai s u - s.str.cat([u, u.values, ['A', 'B', 'C', 'D'], map(str, u.index)], na_rep='-') + s.str.cat([u.values, ['A', 'B', 'C', 'D'], map(str, u.index)], na_rep='-') All elements must match in length to the calling ``Series`` (or ``Index``), except those having an index if ``join`` is not None: diff --git a/doc/source/whatsnew/v0.23.0.txt b/doc/source/whatsnew/v0.23.0.txt index 2430b6ac2bbd4..7509c502f27ed 100644 --- a/doc/source/whatsnew/v0.23.0.txt +++ b/doc/source/whatsnew/v0.23.0.txt @@ -202,7 +202,7 @@ for storing ip addresses. ...: ``IPArray`` isn't a normal 1-D NumPy array, but because it's a pandas -:class:`~pandas.api.extension.ExtensionArray`, it can be stored properly inside pandas' containers. +:class:`~pandas.api.extensions.ExtensionArray`, it can be stored properly inside pandas' containers. .. code-block:: ipython diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index a2210c39bb6a6..1c3d80bdc3abd 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -81,7 +81,7 @@ Other Enhancements (:issue:`21627`) - New method :meth:`HDFStore.walk` will recursively walk the group hierarchy of an HDF5 file (:issue:`10932`) - :func:`read_html` copies cell data across ``colspan``s and ``rowspan``s, and it treats all-``th`` table rows as headers if ``header`` kwarg is not given and there is no ``thead`` (:issue:`17054`) -- :meth:`Series.nlargest`, :meth:`Series.nsmallest`, :meth:`DataFrame.nlargest`, and :meth:`DataFrame.nsmallest` now accept the value ``"all"`` for the ``keep` argument. This keeps all ties for the nth largest/smallest value (:issue:`16818`) +- :meth:`Series.nlargest`, :meth:`Series.nsmallest`, :meth:`DataFrame.nlargest`, and :meth:`DataFrame.nsmallest` now accept the value ``"all"`` for the ``keep`` argument. This keeps all ties for the nth largest/smallest value (:issue:`16818`) - :class:`IntervalIndex` has gained the :meth:`~IntervalIndex.set_closed` method to change the existing ``closed`` value (:issue:`21670`) - @@ -183,15 +183,8 @@ ExtensionType Changes - :meth:`Series.combine()` with scalar argument now works for any function type (:issue:`21248`) - -.. _whatsnew_0240.api.other: - -Other API Changes -^^^^^^^^^^^^^^^^^ - .. _whatsnew_0240.api.incompatibilities: -- Trying to reindex a ``DataFrame`` with a non unique ``MultiIndex`` now raises a ``ValueError`` instead of an ``Exception`` (:issue:`21770`) - Series and Index Data-Dtype Incompatibilities ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -231,7 +224,7 @@ Other API Changes - :class:`DatetimeIndex` now accepts :class:`Int64Index` arguments as epoch timestamps (:issue:`20997`) - Invalid construction of ``IntervalDtype`` will now always raise a ``TypeError`` rather than a ``ValueError`` if the subdtype is invalid (:issue:`21185`) -- +- Trying to reindex a ``DataFrame`` with a non unique ``MultiIndex`` now raises a ``ValueError`` instead of an ``Exception`` (:issue:`21770`) - .. _whatsnew_0240.deprecations: diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 97592ab75845a..7e8fef9644d8c 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -4199,8 +4199,9 @@ def dropna(self, axis=0, how='any', thresh=None, subset=None, * 1, or 'columns' : Drop columns which contain missing value. .. deprecated:: 0.23.0 - Pass tuple or list to drop on multiple axes. - Only a single axis is allowed. + + Pass tuple or list to drop on multiple axes. + Only a single axis is allowed. how : {'any', 'all'}, default 'any' Determine if row or column is removed from DataFrame, when we have @@ -4208,6 +4209,7 @@ def dropna(self, axis=0, how='any', thresh=None, subset=None, * 'any' : If any NA values are present, drop that row or column. * 'all' : If all values are NA, drop that row or column. + thresh : int, optional Require that many non-NA values. subset : array-like, optional @@ -4676,10 +4678,11 @@ def nsmallest(self, n, columns, keep='first'): Column name or names to order by keep : {'first', 'last', 'all'}, default 'first' Where there are duplicate values: + - ``first`` : take the first occurrence. - ``last`` : take the last occurrence. - ``all`` : do not drop any duplicates, even it means - selecting more than `n` items. + selecting more than `n` items. .. versionadded:: 0.24.0 diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index 353a92e25d3cf..a1e9a9a6e561d 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -1879,6 +1879,7 @@ def tz_localize(self, tz, ambiguous='raise', errors='raise'): remove the time zone information preserving local time. ambiguous : str {'infer', 'NaT', 'raise'} or bool array, default 'raise' + - 'infer' will attempt to infer fall dst-transition hours based on order - bool-ndarray where True signifies a DST time, False signifies a @@ -1887,10 +1888,12 @@ def tz_localize(self, tz, ambiguous='raise', errors='raise'): - 'NaT' will return NaT where there are ambiguous times - 'raise' will raise an AmbiguousTimeError if there are ambiguous times + errors : {'raise', 'coerce'}, default 'raise' + - 'raise' will raise a NonExistentTimeError if a timestamp is not - valid in the specified time zone (e.g. due to a transition from - or to DST time) + valid in the specified time zone (e.g. due to a transition from + or to DST time) - 'coerce' will return NaT if the timestamp can not be converted to the specified time zone