Skip to content

Commit a0a9d01

Browse files
committed
Time Series Data - matplotlib series
1 parent 06c341e commit a0a9d01

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

08-Time Series/data.csv

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Date,Open,High,Low,Close,Adj Close,Volume
2+
2019-05-18,7266.080078,8281.660156,7257.259766,8193.139648,8193.139648,723011166
3+
2019-05-19,8193.139648,8193.139648,7591.850098,7998.290039,7998.290039,637617163
4+
2019-05-20,7998.290039,8102.319824,7807.770020,7947.930176,7947.930176,357803946
5+
2019-05-21,7947.930176,8033.759766,7533.660156,7626.890137,7626.890137,424501866
6+
2019-05-22,7626.890137,7971.259766,7478.740234,7876.500000,7876.500000,386766321
7+
2019-05-23,7876.500000,8165.450195,7801.569824,7996.399902,7996.399902,413162746
8+
2019-05-24,7996.399902,8140.819824,7948.680176,8059.129883,8059.129883,179206342
9+
2019-05-25,8059.129883,8779.000000,7894.529785,8726.230469,8726.230469,483663699
10+
2019-05-26,8726.230469,8931.530273,8668.459961,8785.169922,8785.169922,507164714
11+
2019-05-27,8785.169922,8818.709961,8562.200195,8718.849609,8718.849609,360752199
12+
2019-05-28,8718.849609,8760.480469,8444.099609,8664.559570,8664.559570,380343928
13+
2019-05-29,8664.559570,9065.889648,8027.209961,8276.250000,8276.250000,815525590
14+
2019-05-30,8276.250000,8570.780273,8116.000000,8560.080078,8560.080078,500141087
15+
2019-05-31,8550.629883,8576.339844,8459.650391,8504.980469,8504.980469,69915456

08-Time Series/demo.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from matplotlib import pyplot as plt
2+
from matplotlib import dates as mpl_dates
3+
import pandas as pd
4+
5+
plt.style.use('seaborn')
6+
7+
data = pd.read_csv('data.csv')
8+
9+
data['Date'] = pd.to_datetime(data['Date'])
10+
data.sort_values('Date', inplace=True)
11+
12+
price_date = data['Date']
13+
price_close = data['Close']
14+
15+
plt.plot_date(price_date, price_close, linestyle='solid')
16+
plt.gcf().autofmt_xdate()
17+
18+
plt.title('Bitcoin Prices')
19+
plt.xlabel('Date')
20+
plt.ylabel('Closing Price')
21+
plt.tight_layout()
22+
23+
plt.savefig('plot.png')
24+
plt.show()

08-Time Series/plot.png

38.5 KB
Loading

0 commit comments

Comments
 (0)