Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- from dateutil import parser
- 1.Create list:
- column_date = list(df_jobs['Date'])
- column_date
- 2.Data Cleaning
- new_column_date = []
- for item in column_date:
- day = str(item[0]).rstrip()
- month = str(item[1]).replace(',','')
- new_column_date.append(f"{day}-{month}")
- new_column_date
- df_jobs['Date'] = new_column_date
- #delete rows contain "today"
- df_jobs = df_jobs[~df_jobs.Date.str.contains("today", na=False)]
- df_jobs
- 3.Parse string to DateTime:
- df_jobs['Date'] = [parser.parse(x) for x in df_jobs['Date']]
- df_jobs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement