(Apr-24-2017, 04:39 PM)nilamo Wrote:(Apr-24-2017, 04:30 PM)smw10c Wrote: Additionally, the code above did not work. It states that "name NaN is not defined".
You should probably share your entire code then, instead of a small snippet which we all knew wouldn't work :P
Haha okay!
dict3={'initial cost': ['$75000.00','$0.00','$30000.00','$1500.00','$19500.00'],'Total Est. Fee':['$986.00','$1144.00','$522.50', '$225.00', '$389.50']}
df3=pd.DataFrame(dict3)
df3['Total Est. Fee']=df3['Total Est. Fee'].str.split('$')
df3['Total Est. Fee']=df3['Total Est. Fee'].str.get(1)
df3['initial cost']=df3['initial cost'].str.split('$')
df3['initial cost']=df3['initial cost'].str.get(1)
df3['Total Est. Fee']=pd.to_numeric(df3['Total Est. Fee'],errors='coerce')
df3['diff']=df3['initial cost']-df3['Total Est. Fee']
df3.diff[df3.diff < 0] = NaN
For some reason the second to last line of code isn't running anymore even though it ran earlier...