Pandas: Importing Date And 12 Hour Time Together
I have the following txt file: Temp Hi Low Out Dew Wind Wind Wind Hi Hi Wind Heat THW THSW Rain Solar Solar Hi Solar UV UV H
Solution 1:
try this:
For dd/mm/yy
format:
defparse_dt(dt, tm, ap):
return pd.to_datetime(dt + ' ' + tm + ap, dayfirst=True)
For mm/dd/yy
format:
defparse_dt(dt, tm, ap):
return pd.to_datetime(dt + ' ' + tm + ap)
Parse CSV:
df = pd.read_csv(filename, sep='\s+', skiprows=2, header=None,
parse_dates={'ts': [0,1,2] }, date_parser=parse_dt)
Post a Comment for "Pandas: Importing Date And 12 Hour Time Together"