Can';t检测数据帧中的NaN值(python)

Can';t检测数据帧中的NaN值(python),python,pandas,osmnx,Python,Pandas,Osmnx,我从osmnx获得了一个geodataframe: cities = ox.geocode_to_gdf(['Município de Lisboa', 'Município de Oeiras', 'Município da Amadora', 'Município de Loures', 'Município de Odivelas']) whole_polygon = cities.unary_union #unary union of both geometries G = ox.gra

我从osmnx获得了一个geodataframe:

cities = ox.geocode_to_gdf(['Município de Lisboa', 'Município de Oeiras', 'Município da Amadora', 'Município de Loures', 'Município de Odivelas'])
whole_polygon = cities.unary_union #unary union of both geometries
G = ox.graph_from_polygon(whole_polygon, network_type='drive', simplify=True)
G_nx = nx.relabel.convert_node_labels_to_integers(G)

nodes, edges = ox.graph_to_gdfs(G_nx, nodes=True, edges =  True)

我试图确定
name
列的值何时为
NaN
,但由于某些原因,它无法检测到:

for i in range(len(edges)):

    if edges['name'].iloc[i] == float('nan'):
        print('here')

我尝试了
float('NaN')
而不是代码中的内容。我检查了
name
值为
NaN
时,变量实际上是一个浮点。名称列中有三种类型的值:
list
str
float
,其中只有当值为
NaN

if edges['name']时才有浮点数。isnull():
print('here')
如果edges['name']时才有浮点数。iloc[i]。isnull():print('here'))忘了
iloc
哦,我明白了,那确实有效是的。我忘记了数据可能实际上丢失了,而不是实际的浮动
data = {"h":[1,np.nan,2]}
pd.DataFrame(data).isnull()

#output
    h
0   False
1   True
2   False