Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/359.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 从dataframe列检查字符串是否为nan_Python_Pandas - Fatal编程技术网

Python 从dataframe列检查字符串是否为nan

Python 从dataframe列检查字符串是否为nan,python,pandas,Python,Pandas,当我打印数据['words']时,从数据框中获取值 ['from' 'fairest' 'creatures' 'we' 'desire' 'increase' nan 'that' 'thereby'] 当我这样循环时,如何识别值是否为nan for w in data['words'].values: check if w is nan ???? 使用pandas方法测试: 问题是关于是否: for i in range(150,160): if (pd.isnull(df[

当我打印
数据['words']时,从数据框中获取值

['from' 'fairest' 'creatures' 'we' 'desire' 'increase' nan 'that' 'thereby']
当我这样循环时,如何识别值是否为nan

for w in data['words'].values:
    check if w is nan ????
使用pandas方法测试:


问题是关于是否:

for i in range(150,160):
  if (pd.isnull(df['Text'][i])):
    print('is null')
或计算所有NaN:

cnt=0
for i in range(len(dframe)):
  if (pd.isnull(dframe['Description'][i])):
    cnt+=1
cnt=0
for i in range(len(dframe)):
  if (pd.isnull(dframe['Description'][i])):
    cnt+=1