Dataframe with real index (#5892)

* remove extra print

* dataframe with real index

* corrected dataframe tests

* clippy error

* clippy error
This commit is contained in:
Fernando Herrera
2022-06-26 17:32:18 -05:00
committed by GitHub
parent d3e84daa49
commit c0901ef707
4 changed files with 43 additions and 7 deletions

View File

@@ -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(),
}),
},