Skip to content

Commit

Permalink
Minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Oct 23, 2023
1 parent ce4e413 commit 7be4068
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 5 additions & 6 deletions py-polars/src/expr/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,11 @@ impl PyExpr {

fn shift(&self, n: i64, fill_value: Option<Self>) -> Self {
let expr = self.inner.clone();

if let Some(v) = fill_value {
expr.shift_and_fill(n, v.inner).into()
} else {
expr.shift(n).into()
}
let out = match fill_value {
Some(v) => expr.shift_and_fill(n, v.inner),
None => expr.shift(n)
};
out.into()
}

fn fill_null(&self, expr: Self) -> Self {
Expand Down
11 changes: 5 additions & 6 deletions py-polars/src/lazyframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -836,12 +836,11 @@ impl PyLazyFrame {

fn shift(&self, n: i64, fill_value: Option<PyExpr>) -> Self {
let lf = self.ldf.clone();

if let Some(v) = fill_value {
lf.shift_and_fill(n, v.inner).into()
} else {
lf.shift(n).into()
}
let out = match fill_value {
Some(v) => lf.shift_and_fill(n, v.inner),
None => lf.shift(n)
};
out.into()
}

fn fill_nan(&self, fill_value: PyExpr) -> Self {
Expand Down

0 comments on commit 7be4068

Please sign in to comment.