Query.jl icon indicating copy to clipboard operation
Query.jl copied to clipboard

Names with spaces

Open statspy-ml opened this issue 4 years ago • 2 comments

everything goes well with simple column names like "Name", "Full_Name", "Age", but i cant get it done when i have field names with spaces like "Full Name", "ID Number". This works,

df = x |>
@filter(_.Age > 2) |>
@map({_.Name}) |>
DataFrame  

this does not work:

df = x |>
@filter(_.Age> 2) |>
@map({_."Full Name"}) |>
DataFrame

What i am doing wrong?

statspy-ml avatar Mar 01 '21 06:03 statspy-ml

You could do

x |> @filter(_.Age>2) |> @select(occursin("Full Name")) |> DataFrame

dwinkler1 avatar Mar 02 '21 17:03 dwinkler1

It could be handy to have helper function/macro to clean the column names. Like this... https://cran.r-project.org/web/packages/janitor/vignettes/janitor.html#clean-data.frame-names-with-clean_names

Edit: similar to #272

drbenvincent avatar Jun 12 '21 15:06 drbenvincent