【发布时间】:2019-05-18 15:43:00
【问题描述】:
请给我一个建议好吗?
我有三列,例如:
x y z
0.2 0.5 0.26
0.75 0.58 0.25
0.78 0.86 0.95
0.56 0.75 0.52
0.45 0.47 0.57
0.2 0.58 0.98
结果:我只需要一个具有此序列的列:
xyz
x1 0.2
y1 0.5
z1 0.26
x2 0.75
y2 0.58
z2 0.25
... 0.78
0.86
0.95
…
我没有发现类似的问题...非常感谢。我尝试使用“dcast”(R)或“concat”(Python),但我是堆栈。
【问题讨论】:
-
pandaspivot可能就是你想要的pandas.pydata.org/pandas-docs/stable/generated/… -
@Andrew 这实际上是
melt的问题,与pivot正好相反。 -
有意思,以前没遇到过melt,谢谢!
标签: python r merge concat dcast