I want to remove rows that are blank for a certain column and then filter on that column:
If I do it like this:
df['location'].dropna(inplace=True)
dfloc = df[df['location'] == myvar]
Then I get this error:
IndexingError: Unalignable boolean Series key provided
So I have to use dropna like this instead to avoid the error:
df.dropna(subset = ['location'],inplace=True)
dfloc = df[df['location'] == myvar]
Does anyone know why the first method yields an error while the second does not?
Here is an sample of my DataFrame:
uid date location
1 1114-104119 2017-11-14 10:41:19 Chicago
2 1114-104056 2017-11-14 10:40:56 NaN
3 1114-104055 2017-11-14 10:40:55 LA
4 1114-103223 2017-11-14 10:32:23 NaN
5 1114-103050 2017-11-14 10:30:50 NYC