Skip to content

Commit

Permalink
clippy and format
Browse files Browse the repository at this point in the history
  • Loading branch information
coastalwhite committed Sep 17, 2024
1 parent 40385c6 commit b2a1977
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
9 changes: 6 additions & 3 deletions crates/polars-core/src/frame/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1912,7 +1912,7 @@ impl DataFrame {
StringChunkedBuilder::new(PlSmallStr::from_static("min_value"), num_columns);
let mut max_value_ca =
StringChunkedBuilder::new(PlSmallStr::from_static("max_value"), num_columns);
let mut distinct_count_ca = Vec::with_capacity(num_columns);
let mut distinct_count_ca: Vec<Option<IdxSize>> = Vec::with_capacity(num_columns);

for col in &self.columns {
let metadata = col.get_metadata();
Expand Down Expand Up @@ -1954,8 +1954,11 @@ impl DataFrame {
fast_explode_list_ca.finish().into_column(),
min_value_ca.finish().into_column(),
max_value_ca.finish().into_column(),
UInt32Chunked::new(PlSmallStr::from_static("distinct_count"), distinct_count_ca)
.into_column(),
IdxCa::from_slice_options(
PlSmallStr::from_static("distinct_count"),
&distinct_count_ca[..],
)
.into_column(),
])
}
}
Expand Down
4 changes: 3 additions & 1 deletion crates/polars-python/src/dataframe/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ impl PyDataFrame {
}

pub fn _to_metadata(&self) -> Self {
Self { df: self.df._to_metadata() }
Self {
df: self.df._to_metadata(),
}
}

pub fn group_by_map_groups(
Expand Down
5 changes: 2 additions & 3 deletions py-polars/polars/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -11225,7 +11225,6 @@ def _to_metadata(
stats
Statistics to show
"""

df = self

if columns is not None:
Expand All @@ -11240,8 +11239,8 @@ def _to_metadata(
if isinstance(stats, str):
stats = [stats]

if 'column_name' not in stats:
stats = ['column_name'] + stats
if "column_name" not in stats:
stats = ["column_name"] + stats

md = md.select(stats)

Expand Down
4 changes: 0 additions & 4 deletions py-polars/polars/lazyframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -6879,19 +6879,16 @@ def melt(
streamable=streamable,
)


def _to_metadata(
self,
columns: None | str | list[str] = None,
stats: None | str | list[str] = None,
) -> DataFrame:

"""
Get all runtime metadata for each column.
This is unstable and is meant for debugging purposes.
"""

lf = self

if columns is not None:
Expand All @@ -6901,4 +6898,3 @@ def _to_metadata(
lf = lf.select(columns)

return lf.collect()._to_metadata(stats=stats)

0 comments on commit b2a1977

Please sign in to comment.