mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 07:35:42 +02:00
Complete Dataframe MVP (#3373)
* Dataframe MVP * Removed test csv file * Dataframe MVP * Removed test csv file * New revision polars * New revision polars * csv file reader * argument parser for file reader * Parser from Row primitive * Column conversion * Added as f32 and f64 * Parsing row to dataframe * Removed repeated push to vector * Accept table values to create dataframe * Removed default serde * Dataframe to rows to show data * Save name of file with dataframe * Usage example * Upgrade polars version * Clippy changes * Added print function with head and tail * Move dataframe struct to folder * Lock file after running tests and merge * Optional feature for dataframe * Removed dataframe from plugins * Update primitive.rs Co-authored-by: JT <jonathandturner@users.noreply.github.com>
This commit is contained in:
@ -43,6 +43,10 @@ pub enum InlineShape {
|
||||
// TODO: Error type
|
||||
Error,
|
||||
|
||||
// TODO: Dataframe type
|
||||
#[cfg(feature = "dataframe")]
|
||||
Dataframe,
|
||||
|
||||
// Stream markers (used as bookend markers rather than actual values)
|
||||
BeginningOfStream,
|
||||
EndOfStream,
|
||||
@ -123,6 +127,8 @@ impl InlineShape {
|
||||
UntaggedValue::Table(table) => InlineShape::from_table(table.iter()),
|
||||
UntaggedValue::Error(_) => InlineShape::Error,
|
||||
UntaggedValue::Block(_) => InlineShape::Block,
|
||||
#[cfg(feature = "dataframe")]
|
||||
UntaggedValue::Dataframe(_) => InlineShape::Dataframe,
|
||||
}
|
||||
}
|
||||
|
||||
@ -312,6 +318,8 @@ impl PrettyDebug for FormatInlineShape {
|
||||
.group(),
|
||||
InlineShape::Block => DbgDocBldr::opaque("block"),
|
||||
InlineShape::Error => DbgDocBldr::error("error"),
|
||||
#[cfg(feature = "dataframe")]
|
||||
InlineShape::Dataframe => DbgDocBldr::error("dataframe_pretty_FormatInlineShape"),
|
||||
InlineShape::BeginningOfStream => DbgDocBldr::blank(),
|
||||
InlineShape::EndOfStream => DbgDocBldr::blank(),
|
||||
}
|
||||
|
@ -118,6 +118,8 @@ fn helper(v: &Value) -> Result<toml::Value, ShellError> {
|
||||
UntaggedValue::Table(l) => toml::Value::Array(collect_values(l)?),
|
||||
UntaggedValue::Error(e) => return Err(e.clone()),
|
||||
UntaggedValue::Block(_) => toml::Value::String("<Block>".to_string()),
|
||||
#[cfg(feature = "dataframe")]
|
||||
UntaggedValue::Dataframe(_) => toml::Value::String("<Dataframe>".to_string()),
|
||||
UntaggedValue::Primitive(Primitive::Range(_)) => toml::Value::String("<Range>".to_string()),
|
||||
UntaggedValue::Primitive(Primitive::Binary(b)) => {
|
||||
toml::Value::Array(b.iter().map(|x| toml::Value::Integer(*x as i64)).collect())
|
||||
|
Reference in New Issue
Block a user