Anil
Anil

Reputation: 1108

Add column to dataframe with default value in Deedle

How can I achieve this in Deedle.

Pandas: df['Name'] = 'abc'

Deedle: df?Name = "abc" doesn't work - it expects a series.

Upvotes: 2

Views: 690

Answers (1)

Tomas Petricek
Tomas Petricek

Reputation: 243061

Given a sample data frame with one column:

let df = 
  frame [ "One" => series [ 1 => 1.1; 2 => 2.2 ] ]

To add a new column, you will need to create a series with values for all rows first. Then you can add it to the frame in very similar way to pandas:

df?Two <- series [ for k in df.RowKeys -> k => "abc" ]

Upvotes: 4

Related Questions