Is there a concise functional way to rename columns of a Deedle data frame f
?
f.RenameColumns(...)
is usable, but mutates the data frame it is applied to, so it's a bit of a pain to make the renaming operation idempotent. I have something like f.RenameColumns (fun c -> ( if c.IndexOf( "_" ) < 0 then c else c.Substring( 0, c.IndexOf( "_" ) ) ) + "_renamed")
, which is ugly.
What would be nice is something that creates a new frame from the input frame, like this: Frame( f |> Frame.cols |> Series.keys |> Seq.map someRenamingFunction, f |> Frame.cols |> Series.values )
but this gets tripped up by the second part -- the type of f |> Frame.cols |> Series.values
is not what is required by the Frame
constructor.
How can I concisely transform f |> Frame.cols |> Series.values
so that its result is edible by the Frame
constructor?