问题:
pandas 条件过滤,使用强制类型转换失败
res_data = DF[(0<int(DF.Value)<10)&(DF.ID==165)]
报错:
TypeError: cannot convert the series to <class 'int'>
解决方法:使用map或者astype进行类型转化
DF.Value.map(int) 或 DF.Value.astype(int)
参考:
Python Pandas筛选;TypeError:无法将序列转换为<class'int'> - 问答 - Python中文网
python - Difference between map, applymap and apply methods in Pandas - Stack Overflow