我想映射Title
我的数据框的列的值。我想出的解决方案如下:
df.Columns.[ [ "Title"; "Amount" ] ]
|> Frame.mapCols(fun k s ->
if k = "Title"
then s |> Series.mapValues (string >> someModif >> box)
else s.Observations |> Series)
由于s
类型为ObjectSeries<_>
I,因此必须将其强制转换为string
,然后box
对其进行修改。
有没有建议的方法可以映射到单列的值?
您可以使用GetColumn:
df.GetColumn<string>("Title")
|> Series.mapValues(someModif)
或更F#风格:
df
|> Frame.getCol "Title"
|> Series.mapValues(string >> someModif)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句