I would like to split the panda data frame into 2 based on whether the value in a column satisfies a condition, I can do this if it is just a normal condition.
df1 = df[df['relevant'] == 1]
However, if I do,
df1 = df[earlier_or_later(df['timestamp']) == True]
It doesn't work. Earlier_or_later
is a function I wrote which returns whether the timestamp str in each 'timestamp' column is earlier or later than a threshold.
It seems like 'Series'
object is passed into the function instead of each individual value in column 'timestamp'.
How to accomplish this?