I have a *.csv file containing data that includes date in the format "YYYY-MM" for the first column, letters on the second column, and two columns of data.
It will look something like this:
Date inflation rate CPI-Value LIBOR-Rate
2003-09 inflation rate 80.172 0.81
2003-10 inflation rate 80.132 0.88
2003-11 inflation rate 80.264 0.69
2003-12 inflation rate 80.430 0.75
2004-01 inflation rate 81.163 0.75
2004-02 inflation rate 81.244 0.75
2004-03 inflation rate 81.344 0.75
2004-04 inflation rate 81.436 0.75
2004-05 inflation rate 81.501 0.75
2004-06 inflation rate 81.355 0.81
2004-07 inflation rate 81.494 1.06
2004-08 inflation rate 81.426 1.31
2004-09 inflation rate 81.771 1.44
2004-10 inflation rate 81.757 1.38
2004-11 inflation rate 81.866 1.38
2004-12 inflation rate 81.790 1.44
2005-01 inflation rate 81.994 1.75
2005-02 inflation rate 82.062 1.94
2005-03 inflation rate 82.210 2.13
2005-04 inflation rate 82.219 2.13
2005-05 inflation rate 82.165 2.06
I would like to plot a line graph with the date as the x axis, and the one graph containing the values for CPI and LIBOR.
I have tried using
x, y = np.genfromtxt(CPI_df, usecols=(0, 2), unpack=True, delimiter=',')
plt.plot(x, y, 'ro--')
plt.show()
but there is a value error saying that certain lines have one column instead of two. However, I have already checked the csv file and there are no missing data.
Appreciate any help I can get, thank you!
delimiter=',', but there seems to be no comma in the file you quote