Python问题解决:TypeError: ‘<‘ not supported between instances of ‘float‘ and ‘str‘
出错代码:#按区域得到每组的数据key=df[['区域','产品类别']].apply(tuple,axis=1)gp=df.groupby(key)forkey,gingp:print(f'{key}:{type(g)}')报错:TypeError:'<'notsupportedbetweeninstancesof'float'and'str'解决方法:key=df[['区域','产品类别']]