我试图用熊猫来操纵我的数据。我有这样的数据:
CarModel ProductionData ProductionYear
BMWX1 55000 2005
Accord 100000 2005
BMWX1 34000 2006
Accord 110000 2006
BMWX1 43000 2007
Accord 105000 2007
如何使数据看起来像这样?
CarModel NewColumn
BMWX1 [2005.0, 2006.0, 55000]; [2006.0, 2007.0, 34000]; [2007.0, 2008.0, 43000]
Accord [2005.0, 2006.0, 100000]; [2006.0, 2007.0, 110000]; [2007.0, 2008.0, 105000]
设置
解决方案
看起来像:
下面生成您描述的输出。在
CarModel
上分组(作为column
或移动到index
),然后返回相应的列作为.values
。你知道吗相关问题 更多 >
编程相关推荐