我有一个像这样的df
在其他行中显示一些共同值:
我只想获得一个原始版本,如:
“特伦蒂诺阿尔托阿迪奇”——“詹森”——“12-19”——“80-38-118-0
我尝试了两种方法,效果很好:
df['Regione'] = df.groupby(['fornitore', 'fascia_anagrafica']).cumcount()
或
df = df.groupby(['Regione','fornitore','fascia_anagrafica']).agg({'prima_dose': ['sum'],'seconda_dose':['sum']})
df.reset_index(inplace=True)
但当我将此df放入folium时,我只收到相同的错误:
ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
所以问题是变换后的df
有人可以建议我用另一种方法对这些行进行分组/合并/求和/聚合吗
目前没有回答
相关问题 更多 >
编程相关推荐