我有如下所示的T2D数据:
dfB = pd.DataFrame([[cheapest_brandB[0],wertBereichB]], columns=['brand', 'price'], index=
['cheap'])
dfC = pd.DataFrame([[cheapest_brandC[0],wertBereichC]], columns=['brand', 'price'], index=
['cheap'])
the Result :
brand price
cheap ASUS 200
brand price
cheap HP 500如何将2d合并,并将其转换为3d数据,其中每个2d列都以“游戏”或“休闲”的名称命名。
i want somthing like that :
Gaming Casual
brand price brand price
cheap ASUS 200 HP 500有谁可以帮我?
发布于 2022-06-29 11:02:36
使用concat和keys参数:
df = pd.concat([dfB, dfC], axis=1, keys=('Gaming','Casual'))
print (df)
Gaming Casual
brand price brand price
cheap ASUS 200 HP 500https://stackoverflow.com/questions/72800271
复制相似问题