I have a data frame as shown in the example below.
0 1 2 3
0 a sample 1 NaN
1 sample this 1 NaN
2 this is 1 NaN
3 sample this is 1.0
4 is interesting 0.5 NaN
5 this is interesting 0.5
6 is a sample 1.0
7 is a 0.5 NaN
8 this is a 0.5
9 a sample this 1.0
I need to separate data frames based on their number of columns, for example,
df_1
0 a sample 1
1 sample this 1
2 this is 1
3 is interesting 0.5
4 is a 0.5
and df_2
1 sample this is 1.0
2 this is interesting 0.5
3 is a sample 1.0
4 this is a 0.5
5 a sample this 1.0
These data frames are dynamic. It can have n number of columns. Please suggest some solutions.
Thanks, Aditya.