我有DF:熊貓:調換數據幀
ID url visits count_sec buys
0012ea90a6deb4eeb2924fb13e844136 aliexpress.com 3438 33067 25
0012ea90a6deb4eeb2924fb13e844136 ebay.com 9 44
001342afb153e2775649dc5ae0460605 ozon.ru 1 6
0019b08bc9bb8da21f3b8ecc945a67d3 aliexpress.com 24 2196
0019b08bc9bb8da21f3b8ecc945a67d3 bonprix.ru 42 1378
我需要transponse,並得到
ID url
visits count_sec buys
aliexpress.com ebay.com ozon.ru aliexpress.com bonprix.ru
0012ea90a6deb4eeb2924fb13e844136 3438 33067 25 9 44 0 0 0 0 0 0 0 0 0 0
001342afb153e2775649dc5ae0460605 0 0 0 0 0 0 1 6 0 0 0 0 0 0 0
0019b08bc9bb8da21f3b8ecc945a67d3 0 0 0 0 0 0 0 0 0 24 2196 0 42 1378 0
我怎麼能這樣做?
你需要在Multiindex列中的頂級'url'嗎? – jezrael