Groupby operations on dataframes (#3473)

* Added PolarsStruct enum to implement groupby

* template groupby

* groupby operationi on dataframes
This commit is contained in:
Fernando Herrera
2021-05-23 08:37:04 +01:00
committed by GitHub
parent 5ab4199d71
commit e335e4fddc
23 changed files with 335 additions and 96 deletions

View File

@ -74,7 +74,7 @@ pub enum Type {
/// Dataframe
#[cfg(feature = "dataframe")]
Dataframe,
DataFrame,
}
/// A shape representation of the type of a row
@ -191,7 +191,7 @@ impl Type {
UntaggedValue::Error(_) => Type::Error,
UntaggedValue::Block(_) => Type::Block,
#[cfg(feature = "dataframe")]
UntaggedValue::Dataframe(_) => Type::Dataframe,
UntaggedValue::DataFrame(_) => Type::DataFrame,
}
}
}
@ -298,7 +298,7 @@ impl PrettyDebug for Type {
}
Type::Block => ty("block"),
#[cfg(feature = "dataframe")]
Type::Dataframe => ty("dataframe_pretty_debug_for_Type"),
Type::DataFrame => ty("data_type_formatter"),
}
}
}

View File

@ -51,9 +51,10 @@ pub enum UntaggedValue {
/// A block of Nu code, eg `{ ls | get name ; echo "done" }` with its captured values
Block(Box<hir::CapturedBlock>),
/// NuDataframe
/// Data option that holds the polars structs required to to data
/// manipulation and operations using polars dataframes
#[cfg(feature = "dataframe")]
Dataframe(NuDataFrame),
DataFrame(NuDataFrame),
}
impl UntaggedValue {
@ -671,7 +672,7 @@ impl ShellTypeName for UntaggedValue {
UntaggedValue::Error(_) => "error",
UntaggedValue::Block(_) => "block",
#[cfg(feature = "dataframe")]
UntaggedValue::Dataframe(_) => "dataframe",
UntaggedValue::DataFrame(_) => "dataframe",
}
}
}

View File

@ -25,7 +25,7 @@ impl PrettyDebug for Value {
UntaggedValue::Error(_) => DbgDocBldr::error("error"),
UntaggedValue::Block(_) => DbgDocBldr::opaque("block"),
#[cfg(feature = "dataframe")]
UntaggedValue::Dataframe(_) => DbgDocBldr::opaque("dataframe_prettydebug_for_Value"),
UntaggedValue::DataFrame(_) => DbgDocBldr::opaque("dataframe_prettydebug_for_data"),
}
}
}