我有以下数据框:如何将多维数据帧压缩到单个列中?
0 1 2 3 4 5 6 7 8
0 Twitter (True 01/21/2015) None None None None None None None None
1 Google, Inc. (True 11/07/2016) None None None None None None None None
2 Microsoft, (True 07/01/2016) Facebook (True 11/01/2016) None None None None None None None
3 standard & poors, Inc. (True 11/08/2016) None None None None None None None None
8 apple (True 11/10/2016) apple (True 11/01/2016) None None None None None apple (True 11/01/2016) None
我如何可以压缩上述数据帧到一个单一的数据帧?:
0
0 Twitter (True 01/21/2015)
1 Google, Inc. (True 11/07/2016)
2 Microsoft, (True 07/01/2016) \ Facebook (True 11/01/2016)
3 standard & poors, Inc. (True 11/08/2016) \
8 apple (True 11/10/2016) \ apple (True 11/01/2016) \ apple (True 11/01/2016)
我想:
df = df.iloc[:,0].join('\')
不过,我不明白如何添加分隔符。我应该如何使用分隔符来压缩数据帧?
谢谢,但我有一个奇怪的格式。每个角色都失败了。 – student
哪个更快?...我注意到第一个解决方案需要一点点 – student
在更新解决方案中看到时序 – jezrael