I am trying to extract dates from a set format of MONDAY, JUNE 14, 2021 from a sea of text in a data frame and create a new column for the extracted dates.
For example, the data frame looks like:
| x | title | ii |
|---|---|---|
| xx | aldkla MONDAY, JUNE 14, 2021 slkfdklkdj | lkskjdfkdlskld |
| yy | alksflksd TUESDAY, November, 23, 2020 alfjsldjf | sfdadsf |
And I am trying to create the end product to be:
| x | title | ii | Date |
|---|---|---|---|
| xx | aldkla MONDAY, JUNE 14, 2021 slkfdklkdj | lkskjdfkdlskld | 2021-06-14 |
| yy | alksflksd TUESDAY, November, 23, 2020 alfjsldjf | sfdadsf | 2020-11-23 |
Currently, I have been using the library datefinder because I found it to be able to convert the str to date the best. However, once I start using it with a dataframe it does work. This is what I put.
df = dataframe #the example above
Date = datefinder.find_dates(df.title)
for match in Date:
df["time"] = match
Is there a better method? Or am I going about this all wrong?