如题
这是我的data frame
http://i.imgur.com/USqiil5.jpg
我想要把Death year字段资料为nan的变成0其他都变成1
import pandas as pd
mydata_csv = pd.read_csv('D:\Python\character-deaths.csv',sep = ',',encoding = 'utf-8')
mydata_csv
del mydata_csv['Book of Death']
del mydata_csv['Death Chapter']
if mydata_csv['Death Year'] == None:
mydata_csv['Death Year'] = 0
else:
mydata_csv['Death Year'] = 1
这个是我的程式码
到if那里就错误了QQ