pandas remove time from date
# If opening_date is currently a timestamp: 2021-01-09 00:00:00
opening_date = pd.to_datetime(opening_date).date()
print(opening_date)
# Result: 2021-01-09
pandas remove time from date
# If opening_date is currently a timestamp: 2021-01-09 00:00:00
opening_date = pd.to_datetime(opening_date).date()
print(opening_date)
# Result: 2021-01-09
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
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us