采用:
df = (pd.Dataframe(letters.groupby(letters.index // 3)['Letters'] .apply(list) .values .tolist(), columns=['first','second','third']).fillna(0))print (df) first second third0 A B C1 D E F2 G H I3 J 0 0
欢迎分享,转载请注明来源:内存溢出
采用:
df = (pd.Dataframe(letters.groupby(letters.index // 3)['Letters'] .apply(list) .values .tolist(), columns=['first','second','third']).fillna(0))print (df) first second third0 A B C1 D E F2 G H I3 J 0 0
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)