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