Pandas read_csv with date in 2 columns -


i have csv file following format:

10/09/2009,08:16,99.835,99.835,99.835,99.835,2 

how call pandas.read_csv on such file parses first 2 columns datetime index?

use parse_dates kwarg in read_csv function. see the docs.

df = pd.read_csv(filepath_goes_here, sep=',', parse_dates={'dt': [0, 1]}).set_index('dt') 

you can use date_parser kwarg if have dates in nonstandard formats (the ones in example standard).


Comments