0 votes
1 view
in Data Science by (4.7k points)
edited ago 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')

df.head()

plt.xlabel('Data')

plt.ylabel('Receita')

plt.plot(df)

Error:

IndexError: list index out of range

 

1 Answer

0 votes
by (9.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 

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...