Python Forum

Full Version: Nu-B Q on dropna([list])
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
Probably something stupid but I can't spot it.
droplist = ['City','State', 'Zip', 'Property County', 'Property State']
#This works
df.dropna(subset=['City','State','Zip','Property County', 'Property State'], how ='any',axis=0)
#This doesn't ?
df.dropna(subset=[droplist], how ='any',axis=0)
#KeyError: ['City', 'State', 'Zip', 'Property County', 'Property State']