text_plain_output_1.png
import numpy as np

import pandas as pd

import seaborn as sns

import wfdb

data = '../input/mit-bih-arrhythmia-database/'

patients = ['100', '101', '102', '103', '104', '105', '106', '107', '108', '109', '111', '112', '113', '114', '115', '116', '117', '118', '119', '121', '122', '123', '124', '200', '201', '202', '203', '205', '207', '208', '209', '210', '212', '213', '214', '215', '217', '219', '220', '221', '222', '223', '228', '230', '231', '232', '233', '234']

dataframe = pd.DataFrame()

for pts in patients:
    file = data + pts
    annotation = wfdb.rdann(file, 'atr')
    sym = annotation.symbol
    values, counts = np.unique(sym, return_counts=True)
    df_sub = pd.DataFrame({'symbol': values, 'Counts': counts, 'Patient Number': [pts] * len(counts)})
    dataframe = pd.concat([dataframe, df_sub], axis=0)

ax = sns.countplot(dataframe.symbol)