I have tried to strip and get the data in the .txt file to allow me to plot a simple graph, but i can't seem to get the data into the format that i would like. Could someone guide me in the right direction?
Below is a short example of the data in the text file, and in python i am trying to .read() the text file, then plot a simple graph, using the headings in the text file itself if possible.
Date,Value
2016-03-31,0.7927
2016-03-30,0.7859
2016-03-29,0.7843
2016-03-24,0.7893
2016-03-23,0.792
2016-03-22,0.7897
2016-03-21,0.7818
2016-03-18,0.778
2016-03-17,0.781
2016-03-16,0.7855
2016-03-15,0.7845
my python code that i have tried so far: (this won't be perfect code as i am still sorting through it!)
import numpy as np
import matplotlib.pyplot as plt
with open("EURGBP DATA.txt") as f:
data = f.read()
data = data.split('\n')
x = [row.split()[0] for row in data]
y = [row.split()[1] for row in data]
index = [i for i,val in enumerate(x)]
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.set_title("Plot DAta")
ax1.set_xlabel('x')
ax1.set_ylabel('y')
ax1.set_xticklabels(x)
ax1.plot(index ,y, c='r', label='the data')
leg = ax1.legend()
plt.locator_params(nbins=len(index)-1)
plt.show()
