siuba
siuba copied to clipboard
How to select columns from a list?
How would you select columns from all the items of a list?
With pandas, I would use
import pandas as pd
from siuba.data import mtcars
my_features = ["mpg", "hp", "wt"]
mtcars[my_features]
With R - dplyr,
library("tidyverse")
data(mtcars)
my_features <- c("mpg", "hp", "wt")
mtcars %>% select(my_features)
But with siuba?
from siuba import *
from siuba.data import mtcars
my_features = ["mpg", "hp", "wt"]
mtcars >> select(my_features) # Exception: variable must be either a string or Var instance
Thanks!