在Python中将一条记录拆分为多条记录
在python中,如何将这样的数据转换为这样的数据:
为这样的数据:
In python, how can I convert this data like this :
into this data like this:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
在python中,如何将这样的数据转换为这样的数据:
为这样的数据:
In python, how can I convert this data like this :
into this data like this:
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
您可以使用 np.split(..., 2, axis=1) 将数据帧垂直分成两部分:
输出:
You could use
np.split(..., 2, axis=1)
to split the dataframe vertically into 2 parts:Output:
尝试:
输出:
Try:
Output: