I have a Data Frame with missing values on it.
using DataFrames
df = DataFrame(
Y = ["A", "B", "C", "D", "E", "F"],
Z = ["A", missing, "C", missing, "E", missing]
)
When I tried to transform to lowercase I got a MethodError: no method matching lowercase(::Missing)
message, it doesnβt work because of the missing values:
transform(df, :Y => ByRow(x-> lowercase(x)) => :Y)
So Iβm using:
broadcast(v -> ismissing(v) ? missing : lowercase(v), df[!, :Z]);
- Is there any other simple option to transform a column to lowercase keeping the missing values as it is, something like
df.Z.str.lower()
andtolower(df$Z)
? - Is it possible to use
@pipe
with the broadcast function above?