[英]Convert multiple columns to one column
我希望將多個列合並為一列。
這是我目前的數據集:
Column A Column B Column C
a1 b1 c1
b2 a2 e2
我正在尋找以下輸出
Column D
a1
b1
c1
b2
a2
e2
這可能嗎 ? 使用R還是Python?
使用您提供的數據,您可以使用以下格式執行此操作:
data.frame(ColumnD=c(t(df)))
ColumnD
1 a1
2 b1
3 c1
4 b2
5 a2
6 e2
我們轉置數據,然后將它組合起來。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.