Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change column order in deedle frame

What is the best way to change column order in deedle frame? For example if I have a deedle frame df with columns height, Name, and phone, but I need it in order Name, phone, and height.

like image 730
alexshchep Avatar asked Oct 19 '22 04:10

alexshchep


1 Answers

Deedle has RealignRows extension method, but it turns out that we don't have RealignColumns. This is an omission and if you send a PR to Deedle adding this, that would be awesome!

It can be implemented by looking at the series of columns, realigning the columns and turning that back into a data frame. In C#, this looks as follows:

Frame.FromColumns(df.Columns.Realign(new[] { "key 1", "key 2" }));
like image 112
Tomas Petricek Avatar answered Oct 30 '22 04:10

Tomas Petricek