Skip to content

Commit

Permalink
refactor[rust]: deprecate eager groupby aggregation methods (#4946)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Sep 23, 2022
1 parent bec22c4 commit 2d527ed
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions polars/polars-core/src/frame/groupby/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ impl<'df> GroupBy<'df> {
/// | 2020-08-21 | 15 | 0.15 |
/// +------------+-----------+-----------+
/// ```
#[deprecated(since = "0.24.1", note = "use polars.lazy aggregations")]
pub fn mean(&self) -> PolarsResult<DataFrame> {
let (mut cols, agg_cols) = self.prepare_agg()?;

Expand Down Expand Up @@ -449,6 +450,7 @@ impl<'df> GroupBy<'df> {
/// | 2020-08-21 | 30 |
/// +------------+----------+
/// ```
#[deprecated(since = "0.24.1", note = "use polars.lazy aggregations")]
pub fn sum(&self) -> PolarsResult<DataFrame> {
let (mut cols, agg_cols) = self.prepare_agg()?;

Expand Down Expand Up @@ -486,6 +488,7 @@ impl<'df> GroupBy<'df> {
/// | 2020-08-21 | 10 |
/// +------------+----------+
/// ```
#[deprecated(since = "0.24.1", note = "use polars.lazy aggregations")]
pub fn min(&self) -> PolarsResult<DataFrame> {
let (mut cols, agg_cols) = self.prepare_agg()?;
for agg_col in agg_cols {
Expand Down Expand Up @@ -522,6 +525,7 @@ impl<'df> GroupBy<'df> {
/// | 2020-08-21 | 20 |
/// +------------+----------+
/// ```
#[deprecated(since = "0.24.1", note = "use polars.lazy aggregations")]
pub fn max(&self) -> PolarsResult<DataFrame> {
let (mut cols, agg_cols) = self.prepare_agg()?;
for agg_col in agg_cols {
Expand Down Expand Up @@ -558,6 +562,7 @@ impl<'df> GroupBy<'df> {
/// | 2020-08-21 | 20 |
/// +------------+------------+
/// ```
#[deprecated(since = "0.24.1", note = "use polars.lazy aggregations")]
pub fn first(&self) -> PolarsResult<DataFrame> {
let (mut cols, agg_cols) = self.prepare_agg()?;
for agg_col in agg_cols {
Expand Down Expand Up @@ -594,6 +599,7 @@ impl<'df> GroupBy<'df> {
/// | 2020-08-21 | 10 |
/// +------------+------------+
/// ```
#[deprecated(since = "0.24.1", note = "use polars.lazy aggregations")]
pub fn last(&self) -> PolarsResult<DataFrame> {
let (mut cols, agg_cols) = self.prepare_agg()?;
for agg_col in agg_cols {
Expand Down Expand Up @@ -630,6 +636,7 @@ impl<'df> GroupBy<'df> {
/// | 2020-08-21 | 2 |
/// +------------+---------------+
/// ```
#[deprecated(since = "0.24.1", note = "use polars.lazy aggregations")]
pub fn n_unique(&self) -> PolarsResult<DataFrame> {
let (mut cols, agg_cols) = self.prepare_agg()?;
for agg_col in agg_cols {
Expand All @@ -653,6 +660,7 @@ impl<'df> GroupBy<'df> {
/// df.groupby(["date"])?.select(["temp"]).quantile(0.2, QuantileInterpolOptions::default())
/// }
/// ```
#[deprecated(since = "0.24.1", note = "use polars.lazy aggregations")]
pub fn quantile(
&self,
quantile: f64,
Expand Down Expand Up @@ -684,6 +692,7 @@ impl<'df> GroupBy<'df> {
/// df.groupby(["date"])?.select(["temp"]).median()
/// }
/// ```
#[deprecated(since = "0.24.1", note = "use polars.lazy aggregations")]
pub fn median(&self) -> PolarsResult<DataFrame> {
let (mut cols, agg_cols) = self.prepare_agg()?;
for agg_col in agg_cols {
Expand All @@ -696,6 +705,7 @@ impl<'df> GroupBy<'df> {
}

/// Aggregate grouped `Series` and determine the variance per group.
#[deprecated(since = "0.24.1", note = "use polars.lazy aggregations")]
pub fn var(&self, ddof: u8) -> PolarsResult<DataFrame> {
let (mut cols, agg_cols) = self.prepare_agg()?;
for agg_col in agg_cols {
Expand All @@ -708,6 +718,7 @@ impl<'df> GroupBy<'df> {
}

/// Aggregate grouped `Series` and determine the standard deviation per group.
#[deprecated(since = "0.24.1", note = "use polars.lazy aggregations")]
pub fn std(&self, ddof: u8) -> PolarsResult<DataFrame> {
let (mut cols, agg_cols) = self.prepare_agg()?;
for agg_col in agg_cols {
Expand Down Expand Up @@ -816,6 +827,7 @@ impl<'df> GroupBy<'df> {
/// | 2020-08-21 | "[Some(20), Some(10)]" |
/// +------------+------------------------+
/// ```
#[deprecated(since = "0.24.1", note = "use polars.lazy aggregations")]
pub fn agg_list(&self) -> PolarsResult<DataFrame> {
let (mut cols, agg_cols) = self.prepare_agg()?;
for agg_col in agg_cols {
Expand Down Expand Up @@ -844,6 +856,7 @@ impl<'df> GroupBy<'df> {
}

/// Apply a closure over the groups as a new DataFrame in parallel.
#[deprecated(since = "0.24.1", note = "use polars.lazy aggregations")]
pub fn par_apply<F>(&self, f: F) -> PolarsResult<DataFrame>
where
F: Fn(DataFrame) -> PolarsResult<DataFrame> + Send + Sync,
Expand Down

0 comments on commit 2d527ed

Please sign in to comment.