[英]How to merge every 3 rows of a Dataframe into 1 row (with 3 columns)
Any one please tell me how to merge every 3 rows of a Dataframe (has only 1 column) into 1 row (with 3 columns) For example, this is my original Dataframe任何人请告诉我如何将Dataframe(只有1列)的每3行合并为1行(3列)例如,这是我原来的Dataframe
66.0
34.6
1592667774.0
66.0
34.6
1592667784.0
66.0
34.6
1592667794.0
66.0
34.6
1592667805.0
And I want to convert it to我想把它转换成
66.0 34.6 1592667774.0
66.0 34.6 1592667784.0
66.0 34.6 1592667794.0
66.0 34.6 1592667805.0
Thank you for taking the time to read this question!感谢您花时间阅读这个问题!
df_new = pd.DataFrame(df_old.iloc[:, 0].values.reshape((-1, 3)))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.