Skip to content

Commit

Permalink
Remove deprecated functionality (#4316)
Browse files Browse the repository at this point in the history
* Remove deprecated epoch functions

* Remove deprecated and_time_zone/unit

* Remove deprecated to_csv/json/etc functions

* Remove deprecated distinct functions

* Remove deprecated get_group function

* Remove deprecated map_binary function

* Remove deprecated aliases
  • Loading branch information
stinodego committed Aug 8, 2022
1 parent 2dd044c commit e5cfa25
Show file tree
Hide file tree
Showing 22 changed files with 34 additions and 531 deletions.
7 changes: 0 additions & 7 deletions py-polars/docs/source/reference/dataframe.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,10 @@ Conversion
:toctree: api/

DataFrame.to_arrow
DataFrame.to_avro
DataFrame.to_csv
DataFrame.to_dict
DataFrame.to_dicts
DataFrame.to_ipc
DataFrame.to_json
DataFrame.to_numpy
DataFrame.to_pandas
DataFrame.to_parquet
DataFrame.to_struct

Aggregation
Expand Down Expand Up @@ -83,7 +78,6 @@ Manipulation/ selection

DataFrame.cleared
DataFrame.clone
DataFrame.distinct
DataFrame.drop
DataFrame.drop_in_place
DataFrame.drop_nulls
Expand Down Expand Up @@ -166,7 +160,6 @@ This namespace comes available by calling `DataFrame.groupby(..)`.
GroupBy.apply
GroupBy.count
GroupBy.first
GroupBy.get_group
GroupBy.groups
GroupBy.head
GroupBy.last
Expand Down
5 changes: 0 additions & 5 deletions py-polars/docs/source/reference/expression.rst
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,10 @@ The following methods are available under the `expr.dt` attribute.
.. autosummary::
:toctree: api/

ExprDateTimeNameSpace.and_time_unit
ExprDateTimeNameSpace.and_time_zone
ExprDateTimeNameSpace.cast_time_unit
ExprDateTimeNameSpace.day
ExprDateTimeNameSpace.days
ExprDateTimeNameSpace.epoch
ExprDateTimeNameSpace.epoch_days
ExprDateTimeNameSpace.epoch_milliseconds
ExprDateTimeNameSpace.epoch_seconds
ExprDateTimeNameSpace.hour
ExprDateTimeNameSpace.hours
ExprDateTimeNameSpace.milliseconds
Expand Down
1 change: 0 additions & 1 deletion py-polars/docs/source/reference/lazyframe.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ Manipulation/ selection

LazyFrame.cleared
LazyFrame.clone
LazyFrame.distinct
LazyFrame.drop
LazyFrame.drop_nulls
LazyFrame.explode
Expand Down
5 changes: 0 additions & 5 deletions py-polars/docs/source/reference/series.rst
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,10 @@ The following methods are available under the `Series.dt` attribute.
.. autosummary::
:toctree: api/

DateTimeNameSpace.and_time_unit
DateTimeNameSpace.and_time_zone
DateTimeNameSpace.cast_time_unit
DateTimeNameSpace.day
DateTimeNameSpace.days
DateTimeNameSpace.epoch
DateTimeNameSpace.epoch_days
DateTimeNameSpace.epoch_milliseconds
DateTimeNameSpace.epoch_seconds
DateTimeNameSpace.hour
DateTimeNameSpace.hours
DateTimeNameSpace.max
Expand Down
2 changes: 0 additions & 2 deletions py-polars/polars/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def version() -> str:
last,
lit,
map,
map_binary,
max,
mean,
median,
Expand Down Expand Up @@ -223,7 +222,6 @@ def version() -> str:
"cov",
"map",
"apply",
"map_binary",
"fold",
"any",
"all",
Expand Down
82 changes: 0 additions & 82 deletions py-polars/polars/internals/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -6885,53 +6885,6 @@ def epoch(self, tu: str = "us") -> Expr:
else:
raise ValueError(f"time unit {tu} not understood")

def epoch_days(self) -> Expr:
"""
Get the number of days since the unix EPOCH.
If the date is before the unix EPOCH, the number of days will be negative.
.. deprecated:: 0.13.9
Use :func:`epoch` instead.
Returns
-------
Days as Int32
"""
return wrap_expr(self._pyexpr).cast(Date).cast(Int32)

def epoch_milliseconds(self) -> Expr:
"""
Get the number of milliseconds since the unix EPOCH.
If the date is before the unix EPOCH, the number of milliseconds will be
negative.
.. deprecated:: 0.13.9
Use :func:`epoch` instead.
Returns
-------
Milliseconds as Int64
"""
return self.timestamp("ms")

def epoch_seconds(self) -> Expr:
"""
Get the number of seconds since the unix EPOCH
If the date is before the unix EPOCH, the number of seconds will be negative.
.. deprecated:: 0.13.9
Use :func:`epoch` instead.
Returns
-------
Milliseconds as Int64
"""
return wrap_expr(self._pyexpr.dt_epoch_seconds())

def timestamp(self, tu: str = "us") -> Expr:
"""
Return a timestamp in the given time unit.
Expand Down Expand Up @@ -6971,41 +6924,6 @@ def cast_time_unit(self, tu: str) -> Expr:
"""
return wrap_expr(self._pyexpr.dt_cast_time_unit(tu))

def and_time_unit(self, tu: str, dtype: type[DataType] = Datetime) -> Expr:
"""
Set time unit a Series of type Datetime. This does not modify underlying data,
and should be used to fix an incorrect time unit.
.. deprecated::
Use :func:`with_time_unit` instead.
Parameters
----------
tu
Time unit for the `Datetime` Series: any of {"ns", "us", "ms"}
dtype
Output data type.
"""
return self.with_time_unit(tu)

def and_time_zone(self, tz: str | None) -> Expr:
"""
Set time zone for a Series of type Datetime.
.. deprecated::
Use :func:`with_time_zone` instead.
Parameters
----------
tz
Time zone for the `Datetime` Series.
"""
return wrap_expr(self._pyexpr).map(
lambda s: s.dt.with_time_zone(tz), return_dtype=Datetime
)

def with_time_zone(self, tz: str | None) -> Expr:
"""
Set time zone for a Series of type Datetime.
Expand Down

0 comments on commit e5cfa25

Please sign in to comment.