Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to delete records in pandas before a certain date

df['date'] = pd.to_datetime(df['date'])

res = df[~(df['date'] < '2018-04-01')]

print(res)

   key_value       date
2   value_01 2018-04-02
3   value_01 2018-05-13
4   value_01 2018-05-16
7   value_02 2018-04-01
8   value_02 2018-05-16
9   value_02 2018-05-22
11  value_03 2018-04-14
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #delete #records #pandas #date
ADD COMMENT
Topic
Name
1+6 =