Skip to content

DOC: Update Sphinx Deprecated Directive #16512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 27, 2017
29 changes: 22 additions & 7 deletions doc/source/io.rst
Original file line number Diff line number Diff line change
@@ -137,8 +137,10 @@ usecols : array-like or callable, default ``None``
Using this parameter results in much faster parsing time and lower memory usage.
as_recarray : boolean, default ``False``
DEPRECATED: this argument will be removed in a future version. Please call
``pd.read_csv(...).to_records()`` instead.

.. deprecated:: 0.18.2

Please call ``pd.read_csv(...).to_records()`` instead.

Return a NumPy recarray instead of a DataFrame after parsing the data. If
set to ``True``, this option takes precedence over the ``squeeze`` parameter.
@@ -191,7 +193,11 @@ skiprows : list-like or integer, default ``None``
skipfooter : int, default ``0``
Number of lines at bottom of file to skip (unsupported with engine='c').
skip_footer : int, default ``0``
DEPRECATED: use the ``skipfooter`` parameter instead, as they are identical

.. deprecated:: 0.19.0

Use the ``skipfooter`` parameter instead, as they are identical

nrows : int, default ``None``
Number of rows of file to read. Useful for reading pieces of large files.
low_memory : boolean, default ``True``
@@ -202,16 +208,25 @@ low_memory : boolean, default ``True``
use the ``chunksize`` or ``iterator`` parameter to return the data in chunks.
(Only valid with C parser)
buffer_lines : int, default None
DEPRECATED: this argument will be removed in a future version because its
value is not respected by the parser

.. deprecated:: 0.19.0

Argument removed because its value is not respected by the parser

compact_ints : boolean, default False
DEPRECATED: this argument will be removed in a future version

.. deprecated:: 0.19.0

Argument moved to ``pd.to_numeric``

If ``compact_ints`` is ``True``, then for any column that is of integer dtype, the
parser will attempt to cast it as the smallest integer ``dtype`` possible, either
signed or unsigned depending on the specification from the ``use_unsigned`` parameter.
use_unsigned : boolean, default False
DEPRECATED: this argument will be removed in a future version

.. deprecated:: 0.18.2

Argument moved to ``pd.to_numeric``

If integer columns are being compacted (i.e. ``compact_ints=True``), specify whether
the column should be compacted to the smallest signed or unsigned integer dtype.
2 changes: 1 addition & 1 deletion doc/sphinxext/numpydoc/README.rst
Original file line number Diff line number Diff line change
@@ -46,6 +46,6 @@ The following options can be set in conf.py:
methods and attributes. If a table of contents is made, Sphinx expects
each entry to have a separate page.

- numpydoc_edit_link: bool (DEPRECATED -- edit your HTML template instead)
- numpydoc_edit_link: bool (DEPRECATED -- edit your HTML template instead)

Whether to insert an edit link after docstrings.
7 changes: 4 additions & 3 deletions pandas/core/categorical.py
Original file line number Diff line number Diff line change
@@ -398,8 +398,8 @@ def itemsize(self):

def reshape(self, new_shape, *args, **kwargs):
"""
DEPRECATED: calling this method will raise an error in a
future release.
.. deprecated:: 0.19.0
Calling this method will raise an error in a future release.
An ndarray-compatible method that returns `self` because
`Categorical` instances cannot actually be reshaped.
@@ -430,7 +430,8 @@ def base(self):
@classmethod
def from_array(cls, data, **kwargs):
"""
DEPRECATED: Use ``Categorical`` instead.
.. deprecated:: 0.19.0
Use ``Categorical`` instead.
Make a Categorical type from a single array-like object.
7 changes: 4 additions & 3 deletions pandas/core/common.py
Original file line number Diff line number Diff line change
@@ -555,7 +555,8 @@ def in_qtconsole():
"""
check if we're inside an IPython qtconsole
DEPRECATED: This is no longer needed, or working, in IPython 3 and above.
.. deprecated:: 0.14.1
This is no longer needed, or working, in IPython 3 and above.
"""
try:
ip = get_ipython() # noqa
@@ -573,8 +574,8 @@ def in_ipnb():
"""
check if we're inside an IPython Notebook
DEPRECATED: This is no longer used in pandas, and won't work in IPython 3
and above.
.. deprecated:: 0.14.1
This is no longer needed, or working, in IPython 3 and above.
"""
try:
ip = get_ipython() # noqa
16 changes: 9 additions & 7 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
@@ -1338,9 +1338,9 @@ def to_sql(self, name, con, flavor=None, schema=None, if_exists='fail',
Using SQLAlchemy makes it possible to use any DB supported by that
library. If a DBAPI2 object, only sqlite3 is supported.
flavor : 'sqlite', default None
DEPRECATED: this parameter will be removed in a future version,
as 'sqlite' is the only supported option if SQLAlchemy is not
installed.
.. deprecated:: 0.19.0
'sqlite' is the only supported option if SQLAlchemy is not
used.
schema : string, default None
Specify the schema (if database flavor supports this). If None, use
default schema.
@@ -3498,7 +3498,9 @@ def astype(self, dtype, copy=True, errors='raise', **kwargs):
.. versionadded:: 0.20.0
raise_on_error : DEPRECATED use ``errors`` instead
raise_on_error : raise on invalid input
.. deprecated:: 0.20.0
Use ``errors`` instead
kwargs : keyword arguments to pass on to the constructor
Returns
@@ -3602,7 +3604,6 @@ def convert_objects(self, convert_dates=True, convert_numeric=False,
convert_timedeltas=True, copy=True):
"""
Deprecated.
Attempt to infer better dtype for object columns
Parameters
@@ -5809,8 +5810,9 @@ def tz_localize(self, tz, axis=0, level=None, copy=True,
- 'NaT' will return NaT where there are ambiguous times
- 'raise' will raise an AmbiguousTimeError if there are ambiguous
times
infer_dst : boolean, default False (DEPRECATED)
Attempt to infer fall dst-transition hours based on order
infer_dst : boolean, default False
.. deprecated:: 0.15.0
Attempt to infer fall dst-transition hours based on order
Returns
-------
10 changes: 6 additions & 4 deletions pandas/core/indexes/datetimes.py
Original file line number Diff line number Diff line change
@@ -197,8 +197,9 @@ class DatetimeIndex(DatelikeOps, TimelikeOps, DatetimeIndexOpsMixin,
times)
- 'NaT' will return NaT where there are ambiguous times
- 'raise' will raise an AmbiguousTimeError if there are ambiguous times
infer_dst : boolean, default False (DEPRECATED)
Attempt to infer fall dst-transition hours based on order
infer_dst : boolean, default False
.. deprecated:: 0.15.0
Attempt to infer fall dst-transition hours based on order
name : object
Name to be stored in the index
@@ -1818,8 +1819,9 @@ def tz_localize(self, tz, ambiguous='raise', errors='raise'):
.. versionadded:: 0.19.0
infer_dst : boolean, default False (DEPRECATED)
Attempt to infer fall dst-transition hours based on order
infer_dst : boolean, default False
.. deprecated:: 0.15.0
Attempt to infer fall dst-transition hours based on order
Returns
-------
3 changes: 2 additions & 1 deletion pandas/core/indexes/period.py
Original file line number Diff line number Diff line change
@@ -558,7 +558,8 @@ def asfreq(self, freq=None, how='E'):

def to_datetime(self, dayfirst=False):
"""
DEPRECATED: use :meth:`to_timestamp` instead.
.. deprecated:: 0.19.0
Use :meth:`to_timestamp` instead.
Cast to DatetimeIndex.
"""
8 changes: 4 additions & 4 deletions pandas/core/panel4d.py
Original file line number Diff line number Diff line change
@@ -19,10 +19,10 @@
having 4 named dimensions. It is intended as a test bed for more
N-Dimensional named containers.
DEPRECATED. Panel4D is deprecated and will be removed in a future version.
The recommended way to represent these types of n-dimensional data are with
the `xarray package <http://xarray.pydata.org/en/stable/>`__.
Pandas provides a `.to_xarray()` method to automate this conversion.
.. deprecated:: 0.19.0
The recommended way to represent these types of n-dimensional data
are with the `xarray package <http://xarray.pydata.org/en/stable/>`__.
Pandas provides a `.to_xarray()` method to automate this conversion.
Parameters
----------
8 changes: 4 additions & 4 deletions pandas/core/panelnd.py
Original file line number Diff line number Diff line change
@@ -9,10 +9,10 @@ def create_nd_panel_factory(klass_name, orders, slices, slicer, aliases=None,
stat_axis=2, info_axis=0, ns=None):
""" manufacture a n-d class:
DEPRECATED. Panelnd is deprecated and will be removed in a future version.
The recommended way to represent these types of n-dimensional data are with
the `xarray package <http://xarray.pydata.org/en/stable/>`__.
Pandas provides a `.to_xarray()` method to automate this conversion.
.. deprecated:: 0.19.0
The recommended way to represent these types of n-dimensional data
are with the `xarray package <http://xarray.pydata.org/en/stable/>`__.
Pandas provides a `.to_xarray()` method to automate this conversion.
Parameters
----------
5 changes: 3 additions & 2 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
@@ -850,8 +850,9 @@ def repeat(self, repeats, *args, **kwargs):

def reshape(self, *args, **kwargs):
"""
DEPRECATED: calling this method will raise an error in a
future release. Please call ``.values.reshape(...)`` instead.
.. deprecated:: 0.19.0
Calling this method will raise an error. Please call
``.values.reshape(...)`` instead.
return an ndarray with the values shape
if the specified shape matches exactly the current shape, then
4 changes: 2 additions & 2 deletions pandas/core/sparse/array.py
Original file line number Diff line number Diff line change
@@ -391,8 +391,8 @@ def to_dense(self, fill=None):
Parameters
----------
fill: float, default None
DEPRECATED: this argument will be removed in a future version
because it is not respected by this function.
.. deprecated:: 0.20.0
This argument is not respected by this function.
Returns
-------
2 changes: 1 addition & 1 deletion pandas/core/strings.py
Original file line number Diff line number Diff line change
@@ -478,7 +478,7 @@ def str_match(arr, pat, case=True, flags=0, na=np.nan, as_indexer=None):
flags : int, default 0 (no flags)
re module flags, e.g. re.IGNORECASE
na : default NaN, fill value for missing values.
as_indexer : DEPRECATED
as_indexer : DEPRECATED - Keyword is ignored.
Returns
-------
61 changes: 36 additions & 25 deletions pandas/core/window.py
Original file line number Diff line number Diff line change
@@ -342,21 +342,23 @@ def aggregate(self, arg, *args, **kwargs):
Parameters
----------
how : string, default None (DEPRECATED)
Method for down- or re-sampling""")
how : string, default None
.. deprecated:: 0.18.0
Method for down- or re-sampling""")

_shared_docs['mean'] = dedent("""
%(name)s mean
Parameters
----------
how : string, default None (DEPRECATED)
Method for down- or re-sampling""")
how : string, default None
.. deprecated:: 0.18.0
Method for down- or re-sampling""")


class Window(_Window):
"""
Provides rolling window calculcations.
Provides rolling window calculations.
.. versionadded:: 0.18.0
@@ -374,9 +376,10 @@ class Window(_Window):
Minimum number of observations in window required to have a value
(otherwise result is NA). For a window that is specified by an offset,
this will default to 1.
freq : string or DateOffset object, optional (default None) (DEPRECATED)
Frequency to conform the data to before computing the statistic.
Specified as a frequency string or DateOffset object.
freq : string or DateOffset object, optional (default None)
.. deprecated:: 0.18.0
Frequency to conform the data to before computing the statistic.
Specified as a frequency string or DateOffset object.
center : boolean, default False
Set the labels at the center of the window.
win_type : string, default None
@@ -571,8 +574,9 @@ def _apply_window(self, mean=True, how=None, **kwargs):
----------
mean : boolean, default True
If True computes weighted mean, else weighted sum
how : string, default to None (DEPRECATED)
how to resample
how : string, default to None
.. deprecated:: 0.18.0
how to resample
Returns
-------
@@ -736,8 +740,9 @@ def _apply(self, func, name=None, window=None, center=None,
window : int/array, default to _get_window()
center : boolean, default to self.center
check_minp : function, default to _use_window
how : string, default to None (DEPRECATED)
how to resample
how : string, default to None
.. deprecated:: 0.18.0
how to resample
Returns
-------
@@ -864,8 +869,9 @@ def sum(self, *args, **kwargs):
Parameters
----------
how : string, default 'max' (DEPRECATED)
Method for down- or re-sampling""")
how : string, default 'max'
.. deprecated:: 0.18.0
Method for down- or re-sampling""")

def max(self, how=None, *args, **kwargs):
nv.validate_window_func('max', args, kwargs)
@@ -878,8 +884,9 @@ def max(self, how=None, *args, **kwargs):
Parameters
----------
how : string, default 'min' (DEPRECATED)
Method for down- or re-sampling""")
how : string, default 'min'
.. deprecated:: 0.18.0
Method for down- or re-sampling""")

def min(self, how=None, *args, **kwargs):
nv.validate_window_func('min', args, kwargs)
@@ -896,8 +903,9 @@ def mean(self, *args, **kwargs):
Parameters
----------
how : string, default 'median' (DEPRECATED)
Method for down- or re-sampling""")
how : string, default 'median'
.. deprecated:: 0.18.0
Method for down- or re-sampling""")

def median(self, how=None, **kwargs):
if self.freq is not None and how is None:
@@ -1329,9 +1337,10 @@ class Expanding(_Rolling_and_Expanding):
min_periods : int, default None
Minimum number of observations in window required to have a value
(otherwise result is NA).
freq : string or DateOffset object, optional (default None) (DEPRECATED)
Frequency to conform the data to before computing the statistic.
Specified as a frequency string or DateOffset object.
freq : string or DateOffset object, optional (default None)
.. deprecated:: 0.18.0
Frequency to conform the data to before computing the statistic.
Specified as a frequency string or DateOffset object.
center : boolean, default False
Set the labels at the center of the window.
axis : int or string, default 0
@@ -1593,8 +1602,9 @@ class EWM(_Rolling):
min_periods : int, default 0
Minimum number of observations in window required to have a value
(otherwise result is NA).
freq : None or string alias / date offset object, default=None (DEPRECATED)
Frequency to conform to before computing statistic
freq : None or string alias / date offset object, default=None
.. deprecated:: 0.18.0
Frequency to conform to before computing statistic
adjust : boolean, default True
Divide by decaying adjustment factor in beginning periods to account
for imbalance in relative weightings (viewing EWMA as a moving average)
@@ -1727,8 +1737,9 @@ def _apply(self, func, how=None, **kwargs):
Parameters
----------
func : string/callable to apply
how : string, default to None (DEPRECATED)
how to resample
how : string, default to None
.. deprecated:: 0.18.0
how to resample
Returns
-------
17 changes: 10 additions & 7 deletions pandas/io/parsers.py
Original file line number Diff line number Diff line change
@@ -105,8 +105,8 @@
['AAA', 'BBB', 'DDD']``. Using this parameter results in much faster
parsing time and lower memory usage.
as_recarray : boolean, default False
DEPRECATED: this argument will be removed in a future version. Please call
`pd.read_csv(...).to_records()` instead.
.. deprecated:: 0.19.0
Please call `pd.read_csv(...).to_records()` instead.
Return a NumPy recarray instead of a DataFrame after parsing the data.
If set to True, this option takes precedence over the `squeeze` parameter.
@@ -145,7 +145,8 @@
skipfooter : int, default 0
Number of lines at bottom of file to skip (Unsupported with engine='c')
skip_footer : int, default 0
DEPRECATED: use the `skipfooter` parameter instead, as they are identical
.. deprecated:: 0.19.0
Use the `skipfooter` parameter instead, as they are identical
nrows : int, default None
Number of rows of file to read. Useful for reading pieces of large files
na_values : scalar, str, list-like, or dict, default None
@@ -277,17 +278,19 @@
use the `chunksize` or `iterator` parameter to return the data in chunks.
(Only valid with C parser)
buffer_lines : int, default None
DEPRECATED: this argument will be removed in a future version because its
value is not respected by the parser
.. deprecated:: 0.19.0
This argument is not respected by the parser
compact_ints : boolean, default False
DEPRECATED: this argument will be removed in a future version
.. deprecated:: 0.19.0
Argument moved to ``pd.to_numeric``
If compact_ints is True, then for any column that is of integer dtype,
the parser will attempt to cast it as the smallest integer dtype possible,
either signed or unsigned depending on the specification from the
`use_unsigned` parameter.
use_unsigned : boolean, default False
DEPRECATED: this argument will be removed in a future version
.. deprecated:: 0.19.0
Argument moved to ``pd.to_numeric``
If integer columns are being compacted (i.e. `compact_ints=True`), specify
whether the column should be compacted to the smallest signed or unsigned
12 changes: 9 additions & 3 deletions pandas/io/sql.py
Original file line number Diff line number Diff line change
@@ -432,7 +432,9 @@ def to_sql(frame, name, con, flavor=None, schema=None, if_exists='fail',
library.
If a DBAPI2 object, only sqlite3 is supported.
flavor : 'sqlite', default None
DEPRECATED: this parameter will be removed in a future version
.. deprecated:: 0.19.0
'sqlite' is the only supported option if SQLAlchemy is not
used.
schema : string, default None
Name of SQL schema in database to write to (if database flavor
supports this). If None, use default schema (default).
@@ -484,7 +486,9 @@ def has_table(table_name, con, flavor=None, schema=None):
library.
If a DBAPI2 object, only sqlite3 is supported.
flavor : 'sqlite', default None
DEPRECATED: this parameter will be removed in a future version
.. deprecated:: 0.19.0
'sqlite' is the only supported option if SQLAlchemy is not
installed.
schema : string, default None
Name of SQL schema in database to write to (if database flavor supports
this). If None, use default schema (default).
@@ -1545,7 +1549,9 @@ def get_schema(frame, name, flavor=None, keys=None, con=None, dtype=None):
library, default: None
If a DBAPI2 object, only sqlite3 is supported.
flavor : 'sqlite', default None
DEPRECATED: this parameter will be removed in a future version
.. deprecated:: 0.19.0
'sqlite' is the only supported option if SQLAlchemy is not
installed.
dtype : dict of column name to SQL type, default None
Optional specifying the datatype for columns. The SQL type should
be a SQLAlchemy type, or a string for sqlite3 fallback connection.
8 changes: 5 additions & 3 deletions pandas/io/stata.py
Original file line number Diff line number Diff line change
@@ -110,9 +110,11 @@
_statafile_processing_params2, _chunksize_params,
_iterator_params)

_data_method_doc = """Reads observations from Stata file, converting them into a dataframe
_data_method_doc = """\
Reads observations from Stata file, converting them into a dataframe
This is a legacy method. Use `read` in new code.
.. deprecated::
This is a legacy method. Use `read` in new code.
Parameters
----------
@@ -1407,7 +1409,7 @@ def _read_strls(self):
self.GSO[str(v_o)] = va

# legacy
@Appender('DEPRECATED: ' + _data_method_doc)
@Appender(_data_method_doc)
def data(self, **kwargs):

import warnings