python - How to delete the list that constitute "nan"
问题描述
I have data that is taken from excel sheet using data=pd.read_excel("test.xlsx").to_dict()
function. I made several changes on data taken from that function and created such an list
[[0, nan], [1, nan], [2, nan], [3, nan], [4, nan], [5, nan], [6, nan], [7, nan], [8, nan], [9, nan], [10, nan], [11, nan]]
When I try to remove each element that constitute "nan", gives me error that is shown as below
for listinside in list2:
if 'nan' in listinside[1]:
listinside.remove()
else:
pass
print(list2)
TypeError: argument of type 'float' is not iterable
I kindly ask you to help me to remove each element from entire list that constitute 'nan'.
解决方案
推荐阅读
- javascript - 这个 JavaScript document.getElementById('#searchboxinput').dispatchEvent(new MouseEvent('keyup')); 的 selenium python 客户端等价物是什么?
- php - PHP数据库未连接
- javascript - document.querySelectorAll 的结果不一致
- c# - 控制台应用程序:System.IO.FileNotFoundException:找不到文件
- javascript - Eleventy、Nunjucks、Tailwindcss、javascript切换功能隐藏和显示内容
- javascript - 我想限制正则表达式中的子域数量
- linux - 故障处理程序(内核)返回线程进程是否终止
- assembly - 我似乎无法让这个 16 位内存检测汇编代码工作
- powershell - 处理 powershell 数组中的项目 - 多个项目
- python - 删除所有键后大 python 字典的内存占用