it looks like this:
Dates N-D unit
0 1/1/2016 Q1 UD
1 Q2 UD
2 Q3 UD
3 2/1/2016 Q4 UD
4 5/1/2016 Q5 UD
5 Q6 UD
I want to filter out the empty Dates rows and save it in a dataframe blankDate:
Dates N-D unit
1 Q2 UD
2 Q3 UD
5 Q6 UD
blankDate=df1[df1['Dates']== ''] #this didn't work
df1['Discharge Date'] = pd.to_datetime(df1['Discharge Date']) #then I converted the column to date format but still doesn't work
if the column is a string this piece of code works, it also works on numbers I think
blankDate=df1[df1['stringcolumn']== '']
but how do I compare to empty date rows?
One way would be to replace empty cells by nan and then use isnull()
df.Dates = df.Dates.replace('', np.nan)
blankDate = df[df.Dates.isnull()]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With