Jan-14-2024, 03:44 AM
Hi, my original data is short date (15/10/2023) but when I run the below code python changes it to 2023-10-15 00:00:00, how can I prevent this? Cheers.
import pandas as pd
inspdata=pd.read_excel('Inspections data.xlsx')
#remove columns
inspdata.drop(['Notice Creation','count()'],axis=1, inplace=True)
#replace header row names
inspdata.columns=['EForm ID','Contractor','Address','Area','Classification','Program','Notice Ref #','Category','Inspection Type',
'Result','Actual Date','Created Date','Status','CIO','PO']
#delete first 4 rows below the header
inspdata.drop([0,1,2,3],axis=0,inplace=True) #keeps header row
#replace text
inspdata['Classification'].replace(['VACQREP','VACAP'],['VAC','VAC'],inplace=True)
print(inspdata.head(10))
inspdata.to_excel('Inspections Data Python.xlsx',index=False)
