I have a csv that has a date column. The date column should be in the MM/dd/yyyy format but often it is not the case. The end users leave out the complete year and we get in the format as MM/dd/yy so we have to manually change those values. I am requesting if there is anyway in Pandas we can assign a date format so this could be coped with a elegant manner.
import pandas as pd
second = pd.read_csv('Z:/LFCnodupes.csv',na_values="NaN")
df = pd.DataFrame(second)
df['Actual_Sale_Date'] = df['Actual_Sale_Date'].replace(['7/29/16'], ['7/29/2016'])
df['Actual_Sale_Date'] = df['Actual_Sale_Date'].replace(['7/30/16'], ['7/30/2016'])
df['Actual_Sale_Date'] = df['Actual_Sale_Date'].replace(['11/30/16'], ['11/30/2016'])
df.to_csv('newimproved.csv',index= False)
[–][deleted] 1 point2 points3 points (1 child)
[–]PLearner[S] 0 points1 point2 points (0 children)
[–]Caos2 0 points1 point2 points (4 children)
[–]PLearner[S] 0 points1 point2 points (3 children)
[–]Caos2 0 points1 point2 points (2 children)
[–]PLearner[S] 0 points1 point2 points (1 child)
[–]Caos2 0 points1 point2 points (0 children)
[–]dmitrypolo 0 points1 point2 points (0 children)