There should be a way to provide values directly to mutate, transmute, and summarize. For example, you can currently write DataFrame(x=[1,2,3]).mutate(y="5") to add a column of all 5s. If the value is in a variable, then you have to DataFrame(x=[1,2,3]).mutate(y=f"{variable}"), which is awkward.
We cannot simply allow values to be passed into the existing methods because there would be a type instability when providing a string. Here are some possible syntaxes:
val function. df.mutate(y=val(variable))
- Append underscore.
df.mutate_(y=variable)
- Normal name.
df.mutate_values(y=variable)
The advantage of val is that it can be provided at the same time are parsed expressions.
There should be a way to provide values directly to
mutate,transmute, andsummarize. For example, you can currently writeDataFrame(x=[1,2,3]).mutate(y="5")to add a column of all 5s. If the value is in a variable, then you have toDataFrame(x=[1,2,3]).mutate(y=f"{variable}"), which is awkward.We cannot simply allow values to be passed into the existing methods because there would be a type instability when providing a string. Here are some possible syntaxes:
valfunction.df.mutate(y=val(variable))df.mutate_(y=variable)df.mutate_values(y=variable)The advantage of
valis that it can be provided at the same time are parsed expressions.