Deedle
Deedle copied to clipboard
Dataframe Add/Change column accroding the function.
Maybe this feature already exists, but I couldn't find it. I guess it would be useful to have something like this:
let df =
frame [ "A" => series [ 1 => 1.0; 2 => 2.0 ]
"B" => series [ 1 => 4.0; 2 => 5.0 ] ]
let df' = df.SetColumn("C", fun row -> row["A"] + row["B"])
In pandas it's possible with function apply. For example:
filtred['gender_num'] = filtred['gender'].apply(lambda x: 1 if x == 'male' else 0)