There is an excel file logging a set of data. Its columns are as below, where each column is seperated by comma.
SampleData
year,date,month,location,time,count
2019,20,Jan,Japan,22:33,1
2019,31,Jan,Japan,19:21,1
2019,1,Jan,Japan,8:00,1
2019,4,Jan,Japan,4:28,2
2019,13,Feb,Japan,6:19,1
From this data, I would like to create python pandas dataframe, which looks like below.
DataFrame
u_datetime,location,count
1547991180,Japan,1
1548930060,Japan,1
1546297200,Japan,1
1546543680,Japan,2
1550006340,Japan,1
One of the DataFrame methods can be useful for this operation, but it does not take date with one digit.
pandas.to_datetime(
DataFrame["year"].astype(str)
+ DataFrame["month"].astype(str)
+ DataFrame["date"].astype(str)
+ DataFrame["time"].astype(str),
format="%Y%b%d%-H%M"
)
Could anybody give me a hand?
Thank you.