queryverse / Query.jl

Query almost anything in julia
Other
394 stars 49 forks source link

Names with spaces #326

Open statspy-ml opened 3 years ago

statspy-ml commented 3 years ago

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?

dwinkler1 commented 3 years ago

You could do

x |> @filter(_.Age>2) |> @select(occursin("Full Name")) |> DataFrame
drbenvincent commented 3 years ago

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