Deedle icon indicating copy to clipboard operation
Deedle copied to clipboard

Dataframe Add/Change column accroding the function.

Open alexpantyukhin opened this issue 6 years ago • 0 comments

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)

alexpantyukhin avatar Oct 24 '18 19:10 alexpantyukhin