In [1]:
import numpy as np # Linear Alg
import pandas as pd # CSV file I/O & data processing
# Visualization
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import seaborn as sns
import warnings
from matplotlib import style
from matplotlib.finance import candlestick_ohlc
warnings.filterwarnings("ignore")
style.use('ggplot')
%matplotlib inline
plt.rcParams['figure.figsize'] = (12.0, 8.0)
from subprocess import check_output
In [2]:
data_dir = '../../input'
# Check what files our dataset contain
print('Our dataset contains the following files: \n')
print(check_output(["ls", data_dir]).decode("utf8"))
In [3]:
ethereum_price = pd.read_csv('{}/ethereum_price.csv'.format(data_dir), parse_dates=['Date'], index_col=0)
ethereum_price.dtypes
Out[3]:
In [4]:
#view the first fifteen rows
ethereum_price.head(15)
Out[4]:
In [5]:
#view the last fifteen rows
ethereum_price.tail(15)
Out[5]:
In [6]:
print('Date of newest data: {}'.format(ethereum_price.index[0]))
print('Date of oldest data: {}'.format(ethereum_price.index[-1]))
In [7]:
eth_ohlc = ['Open', 'High', 'Low', 'Close']
for feat in eth_ohlc:
print('---------------------------------------------')
print('Statistics for Ethereum {} values:'.format(feat))
print(ethereum_price[feat].describe())
In [8]:
# plotting the open, close, high, low of ethereum on in a line graph
for feat in eth_ohlc:
plt.plot(ethereum_price[feat], label=feat)
plt.xlabel('Time(Yr-M)')
plt.ylabel('Value(USD)')
plt.legend()
plt.show()
In [9]:
#plotting with recent data of ethereum
n_days = 365 # number of recent days
for feature in eth_ohlc:
plt.plot(ethereum_price[feature].iloc[:n_days], label=feature)
plt.title('Pricing Trend(last year)')
plt.xlabel('Time(Yr-M)')
plt.ylabel('Value(USD)')
plt.legend()
plt.show()
In [ ]: