Skip to content

DEPR: 1.x deprecation cleanups #50385

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 2 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions pandas/core/arrays/sparse/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,6 @@ class SparseArray(OpsMixin, PandasObject, ExtensionArray):
A dense array of values to store in the SparseArray. This may contain
`fill_value`.
sparse_index : SparseIndex, optional
index : Index

.. deprecated:: 1.4.0
Use a function like `np.full` to construct an array with the desired
repeats of the scalar value instead.

fill_value : scalar, optional
Elements in data that are ``fill_value`` are not stored in the
SparseArray. For memory savings, this should be the most common value
Expand Down
9 changes: 3 additions & 6 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1758,9 +1758,6 @@ def _get_label_or_level_values(self, key: Level, axis: AxisInt = 0) -> ArrayLike
if `key` matches neither a label nor a level
ValueError
if `key` matches multiple labels
FutureWarning
if `key` is ambiguous. This will become an ambiguity error in a
future version
"""
axis = self._get_axis_number(axis)
other_axes = [ax for ax in range(self._AXIS_LEN) if ax != axis]
Expand Down Expand Up @@ -6035,11 +6032,11 @@ def astype(

Notes
-----
.. deprecated:: 1.3.0
.. versionchanged:: 2.0.0

Using ``astype`` to convert from timezone-naive dtype to
timezone-aware dtype is deprecated and will raise in a
future version. Use :meth:`Series.dt.tz_localize` instead.
timezone-aware dtype will raise an exception.
Use :meth:`Series.dt.tz_localize` instead.

Examples
--------
Expand Down
9 changes: 1 addition & 8 deletions pandas/core/indexes/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,19 +612,13 @@ def _searchsorted_monotonic(self, label, side: Literal["left", "right"] = "left"
# --------------------------------------------------------------------
# Indexing Methods

def get_loc(
self, key, method: str | None = None, tolerance=None
) -> int | slice | np.ndarray:
def get_loc(self, key) -> int | slice | np.ndarray:
"""
Get integer location, slice or boolean mask for requested label.

Parameters
----------
key : label
method : {None}, optional
* default: matches where the label is within an interval only.

.. deprecated:: 1.4

Returns
-------
Expand Down Expand Up @@ -655,7 +649,6 @@ def get_loc(
>>> index.get_loc(pd.Interval(0, 1))
0
"""
self._check_indexing_method(method)
self._check_indexing_error(key)

if isinstance(key, Interval):
Expand Down
2 changes: 0 additions & 2 deletions pandas/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2043,8 +2043,6 @@ def _setitem_single_block(self, indexer, value, name: str) -> None:
if len(item_labels.get_indexer_for([col])) == 1:
# e.g. test_loc_setitem_empty_append_expands_rows
loc = item_labels.get_loc(col)
# Go through _setitem_single_column to get
# FutureWarning if relevant.
self._setitem_single_column(loc, value, indexer[0])
return

Expand Down
4 changes: 2 additions & 2 deletions pandas/core/tools/timedeltas.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ def to_timedelta(
arg : str, timedelta, list-like or Series
The data to be converted to timedelta.

.. deprecated:: 1.2
.. versionchanged:: 2.0
Strings with units 'M', 'Y' and 'y' do not represent
unambiguous timedelta values and will be removed in a future version
unambiguous timedelta values and will raise an exception.

unit : str, optional
Denotes the unit of the arg for numeric `arg`. Defaults to ``"ns"``.
Expand Down