I am reading a csv file (SimResults_Daily.csv) into pandas, that is structured as follows:
#, Job_ID, Date/Time, value1, value2,
0, ID1, 05/01 24:00:00, 5, 6
1, ID2, 05/02 24:00:00, 6, 15
2, ID3, 05/03 24:00:00, 20, 21
etc.
As the datetime format cannot be read by pandas parse_dates, I have figured out I can use the command: str.replace('24:','00:')
.
My code currently is:
dateparse = lambda x: pd.datetime.strptime(x, '%m-%d %H:%M:%S')
df = pd.read_csv('SimResults_Daily.csv',
skipinitialspace=True,
date_parser=dateparse,
parse_dates=['Date/Time'],
index_col=['Date/Time'],
usecols=['Job_ID',
'Date/Time',
'value1',
'value2',
header=0)
Where in the code should I implement the str.replace
command?