I have a big csv file(contains 21 column). The file contains last few days data of user. I want to filter this file based on column values. The column is "Logout Time". Column value is like "Mon Jun 15 11:12:12 EST 2015". I want to make a seperate csv file for those records whose "Logout Time" is "Mon Jun 15" irrespective of the time. I tried to do this using pandas. To get those records I tried this:
df[df['Logout Time'].str.contains("Mon Jun 15")]
this gives me error as:
ValueError : cannot index with vector containing NA / NaN values
I tried this one also:
df[df['Logout Time'].str.contains("Mon Jun 15") == True]
this doesnt filter the results. it gave me whole records of original csv.
df.info()what is log out time? is a str or a datetime dtype? Your first attempt should have worked unless you had no matches, what doesdf['Logout Time'].str.contains("Mon Jun 15")show?df['Logout Time'].dropna().str.contains("Mon Jun 15")return anything?df[df['Logout Time'].dropna().str.contains("Mon Jun 15")]work?