Make $ on variable names optional (#6434)

* DRAFT: make var dollar optional

* couple fixes

* fix some tests + cleanup
This commit is contained in:
JT
2022-08-29 14:35:55 +12:00
committed by GitHub
parent f1d72e2670
commit 3cb9147f22
5 changed files with 43 additions and 9 deletions

View File

@ -32,7 +32,7 @@ impl Command for AppendDF {
vec![
Example {
description: "Appends a dataframe as new columns",
example: r#"let a = ([[a b]; [1 2] [3 4]] | into df);
example: r#"let a = ([['a' 'b']; [1 2] [3 4]] | into df);
$a | append $a"#,
result: Some(
NuDataFrame::try_from_columns(vec![
@ -59,7 +59,7 @@ impl Command for AppendDF {
},
Example {
description: "Appends a dataframe merging at the end of columns",
example: r#"let a = ([[a b]; [1 2] [3 4]] | into df);
example: r#"let a = ([['a' 'b']; [1 2] [3 4]] | into df);
$a | append $a --col"#,
result: Some(
NuDataFrame::try_from_columns(vec![

View File

@ -36,9 +36,9 @@ impl Command for DropNulls {
vec![
Example {
description: "drop null values in dataframe",
example: r#"let df = ([[a b]; [1 2] [3 0] [1 2]] | into df);
let res = ($df.b / $df.b);
let a = ($df | with-column $res --name res);
example: r#"let my_df = ([[a b]; [1 2] [3 0] [1 2]] | into df);
let res = ($my_df.b / $my_df.b);
let a = ($my_df | with-column $res --name 'res');
$a | drop-nulls"#,
result: Some(
NuDataFrame::try_from_columns(vec![

View File

@ -38,9 +38,9 @@ impl Command for TakeDF {
vec![
Example {
description: "Takes selected rows from dataframe",
example: r#"let df = ([[a b]; [4 1] [5 2] [4 3]] | into df);
example: r#"let my_df = ([[a b]; [4 1] [5 2] [4 3]] | into df);
let indices = ([0 2] | into df);
$df | take $indices"#,
$my_df | take $indices"#,
result: Some(
NuDataFrame::try_from_columns(vec![
Column::new(