def parsed_df(**kwargs): # First define the format and then define the function timeFormat = "%Y-%m-%d %H:%M:%S UTC" # This function will iterate over each string in a 1-d array # and use Pandas' implementation of strptime to convert the string into a datetime object. parseTime = lambda x: datetime.strptime(x, timeFormat) return pd.read_csv('/path/to/file.csv',parse_dates=['time'], date_parser=parseTime).set_index('time')
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter