Skip to content

CLN: Remove pre-1.5 deprecations #50377

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
3 changes: 3 additions & 0 deletions doc/source/whatsnew/v2.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,9 @@ Removal of prior version deprecations/changes
- Removed deprecated methods :meth:`ExcelWriter.write_cells`, :meth:`ExcelWriter.save`, :meth:`ExcelWriter.cur_sheet`, :meth:`ExcelWriter.handles`, :meth:`ExcelWriter.path` (:issue:`45795`)
- The :class:`ExcelWriter` attribute ``book`` can no longer be set; it is still available to be accessed and mutated (:issue:`48943`)
- Removed unused ``*args`` and ``**kwargs`` in :class:`Rolling`, :class:`Expanding`, and :class:`ExponentialMovingWindow` ops (:issue:`47851`)
- Removed the deprecated argument ``line_terminator`` from :meth:`DataFrame.to_csv` (:issue:`45302`)
- Removed the deprecated argument ``label`` from :func:`lreshape` (:issue:`30219`)
- Arguments after ``expr`` in :meth:`DataFrame.eval` and :meth:`DataFrame.query` are keyword-only (:issue:`47587`)
-

.. ---------------------------------------------------------------------------
Expand Down
11 changes: 4 additions & 7 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
from pandas.util._decorators import (
Appender,
Substitution,
deprecate_nonkeyword_arguments,
doc,
rewrite_axis_style_signature,
)
Expand Down Expand Up @@ -4189,8 +4188,7 @@ def query(self, expr: str, *, inplace: Literal[True], **kwargs) -> None:
def query(self, expr: str, *, inplace: bool = ..., **kwargs) -> DataFrame | None:
...

@deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "expr"])
def query(self, expr: str, inplace: bool = False, **kwargs) -> DataFrame | None:
def query(self, expr: str, *, inplace: bool = False, **kwargs) -> DataFrame | None:
"""
Query the columns of a DataFrame with a boolean expression.

Expand Down Expand Up @@ -4334,7 +4332,7 @@ def query(self, expr: str, inplace: bool = False, **kwargs) -> DataFrame | None:
if not isinstance(expr, str):
msg = f"expr must be a string to be evaluated, {type(expr)} given"
raise ValueError(msg)
kwargs["level"] = kwargs.pop("level", 0) + 2
kwargs["level"] = kwargs.pop("level", 0) + 1
kwargs["target"] = None
res = self.eval(expr, **kwargs)

Expand All @@ -4359,8 +4357,7 @@ def eval(self, expr: str, *, inplace: Literal[False] = ..., **kwargs) -> Any:
def eval(self, expr: str, *, inplace: Literal[True], **kwargs) -> None:
...

@deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "expr"])
def eval(self, expr: str, inplace: bool = False, **kwargs) -> Any | None:
def eval(self, expr: str, *, inplace: bool = False, **kwargs) -> Any | None:
"""
Evaluate a string describing operations on DataFrame columns.

Expand Down Expand Up @@ -4466,7 +4463,7 @@ def eval(self, expr: str, inplace: bool = False, **kwargs) -> Any | None:
from pandas.core.computation.eval import eval as _eval

inplace = validate_bool_kwarg(inplace, "inplace")
kwargs["level"] = kwargs.pop("level", 0) + 2
kwargs["level"] = kwargs.pop("level", 0) + 1
index_resolvers = self._get_index_resolvers()
column_resolvers = self._get_cleaned_column_resolvers()
resolvers = column_resolvers, index_resolvers
Expand Down
12 changes: 2 additions & 10 deletions pandas/core/reshape/melt.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@

import numpy as np

from pandas.util._decorators import (
Appender,
deprecate_kwarg,
)
from pandas.util._decorators import Appender

from pandas.core.dtypes.common import (
is_extension_array_dtype,
Expand Down Expand Up @@ -161,8 +158,7 @@ def melt(
return result


@deprecate_kwarg(old_arg_name="label", new_arg_name=None)
def lreshape(data: DataFrame, groups, dropna: bool = True, label=None) -> DataFrame:
def lreshape(data: DataFrame, groups, dropna: bool = True) -> DataFrame:
"""
Reshape wide-format data to long. Generalized inverse of DataFrame.pivot.

Expand All @@ -178,10 +174,6 @@ def lreshape(data: DataFrame, groups, dropna: bool = True, label=None) -> DataFr
{new_name : list_of_columns}.
dropna : bool, default True
Do not include columns whose entries are all NaN.
label : None
Not used.

.. deprecated:: 1.0.0

Returns
-------
Expand Down
2 changes: 0 additions & 2 deletions pandas/io/formats/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
StorageOptions,
WriteBuffer,
)
from pandas.util._decorators import deprecate_kwarg

from pandas.core.dtypes.common import (
is_categorical_dtype,
Expand Down Expand Up @@ -1135,7 +1134,6 @@ def to_string(
string = string_formatter.to_string()
return save_to_buffer(string, buf=buf, encoding=encoding)

@deprecate_kwarg(old_arg_name="line_terminator", new_arg_name="lineterminator")
def to_csv(
self,
path_or_buf: FilePath | WriteBuffer[bytes] | WriteBuffer[str] | None = None,
Expand Down
3 changes: 0 additions & 3 deletions pandas/tests/reshape/test_melt.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,9 +658,6 @@ def test_pairs(self):
exp = DataFrame(exp_data, columns=result.columns)
tm.assert_frame_equal(result, exp)

with tm.assert_produces_warning(FutureWarning):
lreshape(df, spec, dropna=False, label="foo")

spec = {
"visitdt": [f"visitdt{i:d}" for i in range(1, 3)],
"wt": [f"wt{i:d}" for i in range(1, 4)],
Expand Down