Rename dataframe describe to summary so that the normal describe isn't overloaded (#7176)

This closes #6770.
This commit is contained in:
Leon 2022-11-24 02:58:28 +10:00 committed by GitHub
parent ed7aea8dd3
commit bdca31cc2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -1,6 +1,5 @@
mod append; mod append;
mod columns; mod columns;
mod describe;
mod drop; mod drop;
mod drop_duplicates; mod drop_duplicates;
mod drop_nulls; mod drop_nulls;
@ -20,6 +19,7 @@ mod shape;
mod slice; mod slice;
mod sql_context; mod sql_context;
mod sql_expr; mod sql_expr;
mod summary;
mod take; mod take;
mod to_arrow; mod to_arrow;
mod to_csv; mod to_csv;
@ -32,7 +32,6 @@ use nu_protocol::engine::StateWorkingSet;
pub use append::AppendDF; pub use append::AppendDF;
pub use columns::ColumnsDF; pub use columns::ColumnsDF;
pub use describe::DescribeDF;
pub use drop::DropDF; pub use drop::DropDF;
pub use drop_duplicates::DropDuplicates; pub use drop_duplicates::DropDuplicates;
pub use drop_nulls::DropNulls; pub use drop_nulls::DropNulls;
@ -52,6 +51,7 @@ pub use shape::ShapeDF;
pub use slice::SliceDF; pub use slice::SliceDF;
pub use sql_context::SQLContext; pub use sql_context::SQLContext;
pub use sql_expr::parse_sql_expr; pub use sql_expr::parse_sql_expr;
pub use summary::Summary;
pub use take::TakeDF; pub use take::TakeDF;
pub use to_arrow::ToArrow; pub use to_arrow::ToArrow;
pub use to_csv::ToCSV; pub use to_csv::ToCSV;
@ -75,7 +75,7 @@ pub fn add_eager_decls(working_set: &mut StateWorkingSet) {
AppendDF, AppendDF,
ColumnsDF, ColumnsDF,
DataTypes, DataTypes,
DescribeDF, Summary,
DropDF, DropDF,
DropDuplicates, DropDuplicates,
DropNulls, DropNulls,

View File

@ -15,15 +15,15 @@ use polars::{
}; };
#[derive(Clone)] #[derive(Clone)]
pub struct DescribeDF; pub struct Summary;
impl Command for DescribeDF { impl Command for Summary {
fn name(&self) -> &str { fn name(&self) -> &str {
"describe" "summary"
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {
"Describes dataframes numeric columns" "For a dataframe, produces descriptive statistics (summary statistics) for its numeric columns."
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
@ -34,15 +34,15 @@ impl Command for DescribeDF {
.named( .named(
"quantiles", "quantiles",
SyntaxShape::Table, SyntaxShape::Table,
"optional quantiles for describe", "provide optional quantiles",
Some('q'), Some('q'),
) )
} }
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {
vec![Example { vec![Example {
description: "dataframe description", description: "list dataframe descriptives",
example: "[[a b]; [1 1] [1 1]] | into df | describe", example: "[[a b]; [1 1] [1 1]] | into df | summary",
result: Some( result: Some(
NuDataFrame::try_from_columns(vec![ NuDataFrame::try_from_columns(vec![
Column::new( Column::new(
@ -266,6 +266,6 @@ mod test {
#[test] #[test]
fn test_examples() { fn test_examples() {
test_dataframe(vec![Box::new(DescribeDF {})]) test_dataframe(vec![Box::new(Summary {})])
} }
} }