text_plain_output_1.png
import matplotlib.pyplot as plt

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

train = pd.read_csv('/kaggle/input/data-without-drift/train_clean.csv')
test = pd.read_csv('/kaggle/input/data-without-drift/test_clean.csv')

batch_indices = [slice(500000 * i, 500000 * (i + 1)) for i in range(10)]

fig, axes = plt.subplots(2,5,sharex=False,sharey=True, figsize=(25,10))
for i,ax in enumerate(axes.ravel()):
    train.iloc[batch_indices[i]].plot(kind='line',x='time',y=['signal'],ax=ax,linewidth=.1)
    ax.set_title('Batch_'+str(i))
ax.set_ylim(-5,14)
ax.legend()
fig.suptitle('Training Data',y=1.05)

plt.tight_layout()

fig, axes = plt.subplots(1,4,sharex=False,sharey=True, figsize=(25,10))
for i,ax in enumerate(axes.ravel()):
    test.iloc[batch_indices[i]].plot(kind='line',x='time',y=['signal'],ax=ax,linewidth=.1)
    ax.set_title('Batch_'+str(i))
ax.set_ylim(-5,11)
ax.legend()
fig.suptitle('Testing Data',y=1.05)

plt.tight_layout()

fig, axes = plt.subplots(2, 5, sharex=True, sharey=True, figsize=(20, 8))
for i, ax in enumerate(axes.ravel()):
    sns.distplot(train.iloc[batch_indices[i]].query('open_channels == 0')['signal'], ax=ax, label='0')
    sns.distplot(train.iloc[batch_indices[i]].query('open_channels == 1')['signal'], ax=ax, label='1')
    sns.distplot(train.iloc[batch_indices[i]].query('open_channels == 2')['signal'], ax=ax, label='2')
    sns.distplot(train.iloc[batch_indices[i]].query('open_channels == 3')['signal'], ax=ax, label='3')
    sns.distplot(train.iloc[batch_indices[i]].query('open_channels == 4')['signal'], ax=ax, label='4')
    sns.distplot(train.iloc[batch_indices[i]].query('open_channels == 5')['signal'], ax=ax, label='5')
    sns.distplot(train.iloc[batch_indices[i]].query('open_channels == 6')['signal'], ax=ax, label='6')
    sns.distplot(train.iloc[batch_indices[i]].query('open_channels == 7')['signal'], ax=ax, label='7')
    sns.distplot(train.iloc[batch_indices[i]].query('open_channels == 8')['signal'], ax=ax, label='8')
    sns.distplot(train.iloc[batch_indices[i]].query('open_channels == 9')['signal'], ax=ax, label='9')
    sns.distplot(train.iloc[batch_indices[i]].query('open_channels == 10')['signal'], ax=ax, label='10')
    ax.set_title('Batch_' + str(i))
ax.legend()
fig.suptitle('Training Data', y=1.05)
ax.set_ylim(0, 2)
plt.tight_layout()