'i have a date within a column in a pandas dataframe. I want to remove part of it. how can I
df
Initialdate Month Day
01/20/2020 Jan Friday
01/21/2019 and 01/25/2019 May Tuesday
01/20/2020 April
I want the second row to only have 01/25/2019. and remove the words before. How can I do this?
Solution 1:[1]
Try this:
df['Initialdate'].str.split().str[-1]
Output:
0 01/20/2020
1 01/25/2019
2 01/20/2020
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
