-2

would anyone be able to provide me with a working example of dataframe zipping in C#? I am bit lost in the operation. Thanks!

rdk
  • 1

1 Answers1

0

The frame.Zip operation is the same thing as zipAlign in the more documented F# API, so have a look at zipAlign in this section of the documentation.

Given a frame df1:

     A 
1 -> 1 
2 -> 2 

And a frame df2:

     A 
2 -> 2 
3 -> 3 

When you call df1.Zip(df2, (int a, int b) -> a + b), you get:

     A         
1 -> <missing> 
2 -> 4         
3 -> <missing> 

That is, for cells where both frames contain a value, a + b is calculated. For all other cells, you get a missing value. Note that you need type annotations in the lambda function - this has to match the type of values in the frame (for not matching types, the function just returns the values from the first frame unchanged).

Tomas Petricek
  • 240,744
  • 19
  • 378
  • 553