Read and Parse Data from a CSV File

I tried to read data that was available online and tried to run the sam script given by the author, but it said there was an error in the script.

df = pd.read_csv('travel-times.csv', parse_dates=[['Date', 'StartTime']], index_col='Date_StartTime')
Error: unexpected '[[' in "df = pd.read_csv('travel-times.csv', parse_dates=[["

Tried to replace the brackets "" with "( )" and then it said:
df = pd.read_csv('travel-times.csv', parse_dates= (('Date', 'StartTime')), index_col='Date_StartTime')
Error: unexpected ',' in "df = pd.read_csv('travel-times.csv', parse_dates= (('Date',"

I am not able to find the error as I am a beginner. Any help is highly appreciated.

Is this an R language question, or a Python language question ?
pd.read_csv makes me think of pandas/python

What is pd.read_csv? Its not any base function of r? What package?

The code you supplied is almost certainly Python. There is equivalent functionality in R(read.csv)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.