I want to replace objects with amount of objects in pandas Data Frame.
Data Frame looks like this:
      [IRN, PAK, TKM, UZB, TJK, CHN]  
                                  []  
                [MNE, GRC, MKD, KOS]  
 [TUN, LBY, NER, ESH, MRT, MLI, MAR]  
                                  []  
                          [FRA, ESP]  
I want to calculate objects in each rows and replace objects with amount to get something like this:
     [IRN, PAK, TKM, UZB, TJK, CHN]   6
                                 []   NaN
               [MNE, GRC, MKD, KOS]   4
[TUN, LBY, NER, ESH, MRT, MLI, MAR]   7
                                 []   NaN
                         [FRA, ESP]   2
 
    