How to form tuple column from two columns in Pandas

后端 未结 4 1797
天命终不由人
天命终不由人 2020-11-28 02:43

I\'ve got a Pandas DataFrame and I want to combine the \'lat\' and \'long\' columns to form a tuple.


Int64Index         


        
4条回答
  •  醉话见心
    2020-11-28 03:03

    Pandas has the itertuples method to do exactly this:

    list(df[['lat', 'long']].itertuples(index=False, name=None))
    

提交回复
热议问题