更新时间:2022-12-12 11:34:20
如果您不介意zip对象,则可以使用df['C'] = zip(df.A,df.B)
.
如果您喜欢元组,则可以使用list()
投射zip对象.请参阅此帖子.在这种情况下使用zip非常方便.
If you don't mind zip object, then you can usedf['C'] = zip(df.A,df.B)
.
If you like tuple then you can cast zip object with list()
. Please refer to this post. It's pretty handy to use zip in this kind of scenarios.