Skip to content

Commit

Permalink
chore(python)!: Scheduled removal of previously deprecated functional…
Browse files Browse the repository at this point in the history
…ity (pola-rs#12885)
  • Loading branch information
stinodego authored Dec 4, 2023
1 parent 447e750 commit acab791
Show file tree
Hide file tree
Showing 32 changed files with 100 additions and 830 deletions.
1 change: 0 additions & 1 deletion py-polars/docs/source/reference/dataframe/descriptive.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Descriptive
:toctree: api/

DataFrame.approx_n_unique
DataFrame.approx_unique
DataFrame.describe
DataFrame.glimpse
DataFrame.estimated_size
Expand Down
1 change: 0 additions & 1 deletion py-polars/docs/source/reference/expressions/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ These functions are available from the polars module root and can be used as exp
arctan2d
arg_sort_by
arg_where
avg
coalesce
concat_list
concat_str
Expand Down
4 changes: 0 additions & 4 deletions py-polars/docs/source/reference/expressions/list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ The following methods are available under the `expr.list` attribute.
Expr.list.count_match
Expr.list.count_matches
Expr.list.diff
Expr.list.difference
Expr.list.eval
Expr.list.explode
Expr.list.first
Expr.list.gather
Expr.list.get
Expr.list.head
Expr.list.intersection
Expr.list.join
Expr.list.last
Expr.list.len
Expand All @@ -44,10 +42,8 @@ The following methods are available under the `expr.list` attribute.
Expr.list.slice
Expr.list.sort
Expr.list.sum
Expr.list.symmetric_difference
Expr.list.tail
Expr.list.take
Expr.list.to_array
Expr.list.to_struct
Expr.list.union
Expr.list.unique
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ Miscellaneous
.. autosummary::
:toctree: api/

Expr.cache
Expr.from_json
Expr.set_sorted
3 changes: 0 additions & 3 deletions py-polars/docs/source/reference/lazyframe/miscellaneous.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,4 @@ Read/write logical plan
:toctree: api/

LazyFrame.deserialize
LazyFrame.from_json
LazyFrame.read_json
LazyFrame.serialize
LazyFrame.write_json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Manipulation/selection
:toctree: api/

LazyFrame.approx_n_unique
LazyFrame.approx_unique
LazyFrame.bottom_k
LazyFrame.cast
LazyFrame.clear
Expand Down
4 changes: 0 additions & 4 deletions py-polars/docs/source/reference/series/list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ The following methods are available under the `Series.list` attribute.
Series.list.count_match
Series.list.count_matches
Series.list.diff
Series.list.difference
Series.list.eval
Series.list.explode
Series.list.first
Series.list.gather
Series.list.get
Series.list.head
Series.list.join
Series.list.intersection
Series.list.last
Series.list.len
Series.list.lengths
Expand All @@ -44,10 +42,8 @@ The following methods are available under the `Series.list` attribute.
Series.list.slice
Series.list.sort
Series.list.sum
Series.list.symmetric_difference
Series.list.tail
Series.list.take
Series.list.to_array
Series.list.to_struct
Series.list.union
Series.list.unique
2 changes: 0 additions & 2 deletions py-polars/polars/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
arctan2d,
arg_sort_by,
arg_where,
avg,
coalesce,
col,
collect_all,
Expand Down Expand Up @@ -336,7 +335,6 @@
"arctan2",
"arctan2d",
"arg_sort_by",
"avg",
"coalesce",
"col",
"collect_all",
Expand Down
13 changes: 0 additions & 13 deletions py-polars/polars/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3434,7 +3434,6 @@ def write_parquet(
data_page_size,
)

@deprecate_renamed_parameter("connection_uri", "connection", version="0.18.9")
@deprecate_renamed_parameter("if_exists", "if_table_exists", version="0.20.0")
def write_database(
self,
Expand Down Expand Up @@ -6320,7 +6319,6 @@ def hstack(
else:
return self._from_pydf(self._df.hstack([s._s for s in columns]))

@deprecate_renamed_parameter("df", "other", version="0.18.8")
def vstack(self, other: DataFrame, *, in_place: bool = False) -> Self:
"""
Grow this DataFrame vertically by stacking a DataFrame to it.
Expand Down Expand Up @@ -9006,17 +9004,6 @@ def approx_n_unique(self) -> DataFrame:
"""
return self.lazy().approx_n_unique().collect(_eager=True)

@deprecate_renamed_function("approx_n_unique", version="0.18.12")
def approx_unique(self) -> DataFrame:
"""
Approximate count of unique values.
.. deprecated:: 0.18.12
This method has been renamed to :func:`DataFrame.approx_n_unique`.
"""
return self.approx_n_unique()

def rechunk(self) -> Self:
"""
Rechunk the data in this DataFrame to a contiguous allocation.
Expand Down
59 changes: 15 additions & 44 deletions py-polars/polars/expr/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
deprecate_renamed_function,
deprecate_renamed_parameter,
deprecate_saturating,
warn_closed_future_change,
)
from polars.utils.meta import threadpool_size
from polars.utils.various import _warn_null_comparison, no_default, sphinx_accessor
Expand Down Expand Up @@ -3627,13 +3626,13 @@ def quantile(
quantile = parse_as_expression(quantile)
return self._from_pyexpr(self._pyexpr.quantile(quantile, interpolation))

@deprecate_nonkeyword_arguments(["self", "breaks"], version="0.18.14")
def cut(
self,
breaks: Sequence[float],
*,
labels: Sequence[str] | None = None,
left_closed: bool = False, # noqa: FBT001
include_breaks: bool = False, # noqa: FBT001
left_closed: bool = False,
include_breaks: bool = False,
) -> Self:
"""
Bin continuous values into discrete categories.
Expand Down Expand Up @@ -3706,16 +3705,14 @@ def cut(
self._pyexpr.cut(breaks, labels, left_closed, include_breaks)
)

@deprecate_nonkeyword_arguments(["self", "quantiles"], version="0.18.14")
@deprecate_renamed_parameter("probs", "quantiles", version="0.18.8")
@deprecate_renamed_parameter("q", "quantiles", version="0.18.12")
def qcut(
self,
quantiles: Sequence[float] | int,
*,
labels: Sequence[str] | None = None,
left_closed: bool = False, # noqa: FBT001
allow_duplicates: bool = False, # noqa: FBT001
include_breaks: bool = False, # noqa: FBT001
left_closed: bool = False,
allow_duplicates: bool = False,
include_breaks: bool = False,
) -> Self:
"""
Bin continuous values into discrete categories based on their quantiles.
Expand Down Expand Up @@ -5557,7 +5554,6 @@ def interpolate(self, method: InterpolationMethod = "linear") -> Self:
"""
return self._from_pyexpr(self._pyexpr.interpolate(method))

@warn_closed_future_change()
def rolling_min(
self,
window_size: int | timedelta | str,
Expand All @@ -5566,7 +5562,7 @@ def rolling_min(
*,
center: bool = False,
by: str | None = None,
closed: ClosedInterval = "left",
closed: ClosedInterval = "right",
warn_if_unsorted: bool = True,
) -> Self:
"""
Expand Down Expand Up @@ -5768,7 +5764,6 @@ def rolling_min(
)
)

@warn_closed_future_change()
def rolling_max(
self,
window_size: int | timedelta | str,
Expand All @@ -5777,7 +5772,7 @@ def rolling_max(
*,
center: bool = False,
by: str | None = None,
closed: ClosedInterval = "left",
closed: ClosedInterval = "right",
warn_if_unsorted: bool = True,
) -> Self:
"""
Expand Down Expand Up @@ -6002,7 +5997,6 @@ def rolling_max(
)
)

@warn_closed_future_change()
def rolling_mean(
self,
window_size: int | timedelta | str,
Expand All @@ -6011,7 +6005,7 @@ def rolling_mean(
*,
center: bool = False,
by: str | None = None,
closed: ClosedInterval = "left",
closed: ClosedInterval = "right",
warn_if_unsorted: bool = True,
) -> Self:
"""
Expand Down Expand Up @@ -6246,7 +6240,6 @@ def rolling_mean(
)
)

@warn_closed_future_change()
def rolling_sum(
self,
window_size: int | timedelta | str,
Expand All @@ -6255,7 +6248,7 @@ def rolling_sum(
*,
center: bool = False,
by: str | None = None,
closed: ClosedInterval = "left",
closed: ClosedInterval = "right",
warn_if_unsorted: bool = True,
) -> Self:
"""
Expand Down Expand Up @@ -6480,7 +6473,6 @@ def rolling_sum(
)
)

@warn_closed_future_change()
def rolling_std(
self,
window_size: int | timedelta | str,
Expand All @@ -6489,7 +6481,7 @@ def rolling_std(
*,
center: bool = False,
by: str | None = None,
closed: ClosedInterval = "left",
closed: ClosedInterval = "right",
ddof: int = 1,
warn_if_unsorted: bool = True,
) -> Self:
Expand Down Expand Up @@ -6724,7 +6716,6 @@ def rolling_std(
)
)

@warn_closed_future_change()
def rolling_var(
self,
window_size: int | timedelta | str,
Expand All @@ -6733,7 +6724,7 @@ def rolling_var(
*,
center: bool = False,
by: str | None = None,
closed: ClosedInterval = "left",
closed: ClosedInterval = "right",
ddof: int = 1,
warn_if_unsorted: bool = True,
) -> Self:
Expand Down Expand Up @@ -6968,7 +6959,6 @@ def rolling_var(
)
)

@warn_closed_future_change()
def rolling_median(
self,
window_size: int | timedelta | str,
Expand All @@ -6977,7 +6967,7 @@ def rolling_median(
*,
center: bool = False,
by: str | None = None,
closed: ClosedInterval = "left",
closed: ClosedInterval = "right",
warn_if_unsorted: bool = True,
) -> Self:
"""
Expand Down Expand Up @@ -7128,7 +7118,6 @@ def rolling_median(
)
)

@warn_closed_future_change()
def rolling_quantile(
self,
quantile: float,
Expand All @@ -7139,7 +7128,7 @@ def rolling_quantile(
*,
center: bool = False,
by: str | None = None,
closed: ClosedInterval = "left",
closed: ClosedInterval = "right",
warn_if_unsorted: bool = True,
) -> Self:
"""
Expand Down Expand Up @@ -9003,24 +8992,6 @@ def shrink_dtype(self) -> Self:
"""
return self._from_pyexpr(self._pyexpr.shrink_dtype())

@deprecate_function(
"This method now does nothing. It has been superseded by the"
" `comm_subexpr_elim` setting on `LazyFrame.collect`, which automatically"
" caches expressions that are equal.",
version="0.18.9",
)
def cache(self) -> Self:
"""
Cache this expression so that it only is executed once per context.
.. deprecated:: 0.18.9
This method now does nothing. It has been superseded by the
`comm_subexpr_elim` setting on `LazyFrame.collect`, which automatically
caches expressions that are equal.
"""
return self

def replace(
self,
mapping: dict[Any, Any],
Expand Down
44 changes: 0 additions & 44 deletions py-polars/polars/expr/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -1238,50 +1238,6 @@ def set_symmetric_difference(self, other: IntoExpr) -> Expr:
other = parse_as_expression(other, str_as_lit=False)
return wrap_expr(self._pyexpr.list_set_operation(other, "symmetric_difference"))

@deprecate_renamed_function("set_union", version="0.18.10")
def union(self, other: IntoExpr) -> Expr:
"""
Compute the SET UNION between the elements in this list and the elements of `other`.
.. deprecated:: 0.18.10
This method has been renamed to :meth:`set_union`.
""" # noqa: W505
return self.set_union(other)

@deprecate_renamed_function("set_difference", version="0.18.10")
def difference(self, other: IntoExpr) -> Expr:
"""
Compute the SET DIFFERENCE between the elements in this list and the elements of `other`.
.. deprecated:: 0.18.10
This method has been renamed to :meth:`set_difference`.
""" # noqa: W505
return self.set_difference(other)

@deprecate_renamed_function("set_intersection", version="0.18.10")
def intersection(self, other: IntoExpr) -> Expr:
"""
Compute the SET INTERSECTION between the elements in this list and the elements of `other`.
.. deprecated:: 0.18.10
This method has been renamed to :meth:`set_intersection`.
""" # noqa: W505
return self.set_intersection(other)

@deprecate_renamed_function("set_symmetric_difference", version="0.18.10")
def symmetric_difference(self, other: IntoExpr) -> Expr:
"""
Compute the SET SYMMETRIC DIFFERENCE between the elements in this list and the elements of `other`.
.. deprecated:: 0.18.10
This method has been renamed to :meth:`set_symmetric_difference`.
""" # noqa: W505
return self.set_symmetric_difference(other)

@deprecate_renamed_function("count_matches", version="0.19.3")
def count_match(self, element: IntoExpr) -> Expr:
"""
Expand Down
Loading

0 comments on commit acab791

Please sign in to comment.