Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- import matplotlib.pyplot as plt
- headers = 'Date', 'Close', 'Open', 'High', 'Low'
- text = '''27/12/2012 4541,79 4560,12 4560,75 4534,55
- 28/12/2012 4561,98 4541,79 4561,99 4536,47
- 31/12/2012 4579,85 4559,31 4579,85 4558,51
- 02/01/2013 4621,99 4588,08 4621,99 4586,71
- 03/01/2013 4642,08 4643,92 4654,52 4621,81
- 04/01/2013 4654,33 4648,85 4677,97 4642,69
- 07/01/2013 4652,74 4651,63 4663,86 4632,11'''.replace(',', '.')
- # --- create data ---
- data = [line.split() for line in text.split('\n')]
- df = pd.DataFrame(data, columns=headers)
- df['Close'] = df['Close'].astype(float)
- # --- plot ---
- p = df['Close'].plot()
- #p.set_xlabel('Date')
- #p.set_ylabel('Close')
- p.set_xticklabels(df['Date'])
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement