Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Data Science by (18.4k points)
edited by

I have been trying to import a file from the past few hours, every time I try I end up getting errors. This is my code which I am using to extract the file :

df = pd.read_csv('arima1.csv', sep=';',parse_dates={'Month':[0, 1]}, index_col = 'Month')






IndexError: list index out of range


1 Answer

0 votes
by (36.8k points)

I search the file on the internet and found the file. After going through the dataset. If found that the dataset needs to be cleaned. The below code will help you export the file:

df = pd.read_csv("arima1.csv",sep='\"+')

# df['Month']= pd.to_datetime(df['Month,'],format="%m/%d/%Y,")

# df['Receita'] = df['Receita'].apply(lambda x: float(x.replace("R$","").replace(",","")))

# df.set_index(['Month'])['Receita'].plot()

If you are a beginner and want to know more about Data Science the do check out the Data Science course 

Browse Categories