[c5b8c2]: / code / eda.py

Download this file

25 lines (18 with data), 656 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import pandas as pd
import numpy as np
import random
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import plotly.graph_objs as go
from collections import Counter
df = pd.read_csv("../input/mitbih_test.csv", header=None)
print(df.shape)
print(Counter(df[187].values))
Y = np.array(df[187].values).astype(np.int8)
X = np.array(df[list(range(187))].values)
indexes = random.sample(list(range(df.shape[0])), 10)
for i in indexes:
data = [go.Scatter(
x=list(range(187)),
y=X[i, :])]
plot({"data": data,
"layout": {"title": "Heartbeat Class : %s "%Y[i]}}, filename='%s.html'%i)