Skip to content

Commit

Permalink
more rust alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Jun 21, 2024
1 parent 131bce9 commit 8766aa3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions crates/polars-core/src/frame/explode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ fn get_exploded(series: &Series) -> PolarsResult<(Series, OffsetsBuffer<i64>)> {
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde-lazy", derive(Serialize, Deserialize))]
pub struct UnpivotArgs {
pub index: Vec<SmartString>,
pub on: Vec<SmartString>,
pub index: Vec<SmartString>,
pub variable_name: Option<SmartString>,
pub value_name: Option<SmartString>,
/// Whether the unpivot may be done
Expand Down Expand Up @@ -247,8 +247,8 @@ impl DataFrame {
let index = index.into_vec();
let on = on.into_vec();
self.unpivot2(UnpivotArgs {
index,
on,
index,
..Default::default()
})
}
Expand Down Expand Up @@ -448,8 +448,8 @@ mod test {
);

let args = UnpivotArgs {
index: vec![],
on: vec![],
index: vec![],
..Default::default()
};

Expand All @@ -464,8 +464,8 @@ mod test {
);

let args = UnpivotArgs {
index: vec!["A".into()],
on: vec![],
index: vec!["A".into()],
..Default::default()
};

Expand Down
2 changes: 1 addition & 1 deletion crates/polars-lazy/src/tests/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ fn test_lazy_unpivot() {
let df = get_df();

let args = UnpivotArgs {
index: vec!["petal_width".into(), "petal_length".into()],
on: vec!["sepal_length".into(), "sepal_width".into()],
index: vec!["petal_width".into(), "petal_length".into()],
..Default::default()
};

Expand Down
8 changes: 4 additions & 4 deletions crates/polars-ops/src/frame/pivot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ where
let values = get_values_columns(pivot_df, &index, &on, values);
pivot_impl(
pivot_df,
&index,
&on,
&index,
&values,
agg_fn,
sort_columns,
Expand Down Expand Up @@ -153,8 +153,8 @@ where
let values = get_values_columns(pivot_df, &index, &on, values);
pivot_impl(
pivot_df,
&index,
&on,
&index,
&values,
agg_fn,
sort_columns,
Expand Down Expand Up @@ -192,11 +192,11 @@ where
fn pivot_impl(
pivot_df: &DataFrame,
// keys of the first group_by operation
on: &[String],
// these columns will be aggregated in the nested group_by
index: &[String],
// these columns will be used for a nested group_by
// the rows of this nested group_by will be pivoted as header column values
on: &[String],
// these columns will be aggregated in the nested group_by
values: &[String],
// aggregation function
agg_fn: Option<PivotAgg>,
Expand Down
2 changes: 1 addition & 1 deletion py-polars/src/dataframe/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ impl PyDataFrame {
variable_name: Option<&str>,
) -> PyResult<Self> {
let args = UnpivotArgs {
index: strings_to_smartstrings(index),
on: strings_to_smartstrings(on),
index: strings_to_smartstrings(index),
value_name: value_name.map(|s| s.into()),
variable_name: variable_name.map(|s| s.into()),
streamable: false,
Expand Down
2 changes: 1 addition & 1 deletion py-polars/src/lazyframe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1121,8 +1121,8 @@ impl PyLazyFrame {
streamable: bool,
) -> Self {
let args = UnpivotArgs {
index: strings_to_smartstrings(index),
on: strings_to_smartstrings(on),
index: strings_to_smartstrings(index),
value_name: value_name.map(|s| s.into()),
variable_name: variable_name.map(|s| s.into()),
streamable,
Expand Down

0 comments on commit 8766aa3

Please sign in to comment.