Convert Pandas Column to DateTime
I have one field in a pandas DataFrame that was imported as string format. It should be a datetime variable. How do I convert it to a datetime column and then filter based on date.
- DataFrame Name: raw_data
- Column Name: Mycol
- Value Format in Column: '05SEP2014:00:00:00.000'
raw_data['Mycol'] = pd.to_datetime(raw_data['Mycol'], format='%d%b%Y:%H:%M:%S.%f')
★ Back to homepage or read more recommendations: