I have this date time column in panda. I am converting it to specific date format. i want to convert this date into string and extract the substring out of it. I am finding it hard to do it. does anyone know how.
data in my datetime column looks like follows:
2024-01-30 13:45:00
2024-01-30 14:45:00
2024-01-30 15:45:00
I have converted it to date column using following statement:
da['date1'] = da['timestamp'].dt.strftime("%y%b%d")
Now my data looks like following:
24Jan30
24Jan30
24Jan30
Note this is in date format.
I want to extract year and month and from it. for that i have to convert it into string which is not giving me expected results.
expected output:
24Jan
24Jan
24Jan
Any help would be greatly appreciated.
Thanks in advance.