mirror of
https://github.com/nushell/nushell.git
synced 2025-08-18 18:28:25 +02:00
Dataframe with real index (#5892)
* remove extra print * dataframe with real index * corrected dataframe tests * clippy error * clippy error
This commit is contained in:
@@ -34,15 +34,20 @@ impl Command for ToNu {
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
let cols = vec!["a".into(), "b".into()];
|
||||
let cols = vec!["index".into(), "a".into(), "b".into()];
|
||||
let rec_1 = Value::Record {
|
||||
cols: cols.clone(),
|
||||
vals: vec![Value::test_int(1), Value::test_int(2)],
|
||||
vals: vec![Value::test_int(0), Value::test_int(1), Value::test_int(2)],
|
||||
span: Span::test_data(),
|
||||
};
|
||||
let rec_2 = Value::Record {
|
||||
cols: cols.clone(),
|
||||
vals: vec![Value::test_int(1), Value::test_int(3), Value::test_int(4)],
|
||||
span: Span::test_data(),
|
||||
};
|
||||
let rec_3 = Value::Record {
|
||||
cols,
|
||||
vals: vec![Value::test_int(3), Value::test_int(4)],
|
||||
vals: vec![Value::test_int(2), Value::test_int(3), Value::test_int(4)],
|
||||
span: Span::test_data(),
|
||||
};
|
||||
|
||||
@@ -51,7 +56,7 @@ impl Command for ToNu {
|
||||
description: "Shows head rows from dataframe",
|
||||
example: "[[a b]; [1 2] [3 4]] | into df | into nu",
|
||||
result: Some(Value::List {
|
||||
vals: vec![rec_1, rec_2.clone()],
|
||||
vals: vec![rec_1, rec_2],
|
||||
span: Span::test_data(),
|
||||
}),
|
||||
},
|
||||
@@ -59,7 +64,7 @@ impl Command for ToNu {
|
||||
description: "Shows tail rows from dataframe",
|
||||
example: "[[a b]; [1 2] [5 6] [3 4]] | into df | into nu -t -n 1",
|
||||
result: Some(Value::List {
|
||||
vals: vec![rec_2],
|
||||
vals: vec![rec_3],
|
||||
span: Span::test_data(),
|
||||
}),
|
||||
},
|
||||
|
Reference in New Issue
Block a user