This is part of on-going work with capabilities when working with

tables and able to work with them for data processing & viewing
purposes. At the moment, certain ways to process said tables we
are able to view a histogram of a given column.

As usage matures, we may find certain core commands that could
be used ergonomically when working with tables on Nu.
This commit is contained in:
Andrés N. Robalino
2019-11-12 03:38:55 -05:00
parent 3163b0d362
commit 00b3c2036a
7 changed files with 147 additions and 109 deletions

View File

@ -31,6 +31,35 @@ fn group_by() {
})
}
#[test]
fn histogram() {
Playground::setup("histogram_test_1", |dirs, sandbox| {
sandbox.with_files(vec![FileWithContentToBeTrimmed(
"los_tres_caballeros.csv",
r#"
first_name,last_name,rusty_at
Andrés,Robalino,Ecuador
Jonathan,Turner,Estados Unidos
Yehuda,Katz,Estados Unidos
"#,
)]);
let actual = nu!(
cwd: dirs.test(), h::pipeline(
r#"
open los_tres_caballeros.csv
| histogram rusty_at countries
| where rusty_at == "Ecuador"
| get countries
| echo $it
"#
));
assert_eq!(actual, "**************************************************");
// 50%
})
}
#[test]
fn group_by_errors_if_unknown_column_name() {
Playground::setup("group_by_test_2", |dirs, sandbox| {
@ -56,7 +85,6 @@ fn group_by_errors_if_unknown_column_name() {
})
}
#[cfg(data_processing_primitives)]
#[test]
fn split_by() {
Playground::setup("split_by_test_1", |dirs, sandbox| {
@ -86,7 +114,6 @@ fn split_by() {
})
}
#[cfg(data_processing_primitives)]
#[test]
fn split_by_errors_if_no_table_given_as_input() {
Playground::setup("split_by_test_2", |dirs, sandbox| {