Get All Unique Values in a Row

前端 未结 3 419
陌清茗
陌清茗 2021-01-12 04:58

I have a DataFrame df1 that looks like this:

A       B       C
-----------------
1       1       2
2       2       3
5       4       9
         


        
3条回答
  •  情话喂你
    2021-01-12 05:48

    Lets use pd.unique i.e

    df.T.agg([pd.unique])
    
            0       1          2
    unique  [1, 2]  [2, 3]  [5, 4, 9]
    

提交回复
热议问题