image_png_output_1.png text_plain_output_2.png text_plain_output_1.png
import matplotlib.pyplot as plt

import os

import pandas as pd

import seaborn as sns

flairs = t1ws = t2ws = t1gds = 0
study = {}
for p in os.listdir('../input/rsna-miccai-brain-tumor-radiogenomic-classification/train'):
    for i in os.listdir('../input/rsna-miccai-brain-tumor-radiogenomic-classification/train/' + p):
        study[p] = {}
        if i == 'FLAIR':
            flairs = len(os.listdir('../input/rsna-miccai-brain-tumor-radiogenomic-classification/train/' + p + '/' + i))
        elif i == 'T1w':
            t1ws = len(os.listdir('../input/rsna-miccai-brain-tumor-radiogenomic-classification/train/' + p + '/' + i))
        elif i == 'T2w':
            t2ws = len(os.listdir('../input/rsna-miccai-brain-tumor-radiogenomic-classification/train/' + p + '/' + i))
        elif i == 'T1wCE':
            t1gds = len(os.listdir('../input/rsna-miccai-brain-tumor-radiogenomic-classification/train/' + p + '/' + i))
        study[p]['FLAIR'] = flairs
        study[p]['T1w'] = t1ws
        study[p]['T2w'] = t2ws
        study[p]['T1wCE'] = t1gds

study = pd.DataFrame(study).transpose()
tmp = study.sort_values('FLAIR', ascending=False)['FLAIR'][:10]
tmp = study.sort_values('T1w', ascending=False)['T1w'][:10]
tmp = study.sort_values('T2w', ascending=False)['T2w'][:10]
tmp = study.sort_values('T1wCE', ascending=False)['T1wCE'][:10]
tmp = ['FLAIR', 'T1w', 'T2w', 'T1wCE']
tmp2 = []
for col in tmp:
    tmp2.append(sum(study[col]))

df = pd.read_csv('../input/rsna-miccai-brain-tumor-radiogenomic-classification/train_labels.csv')
df.columns = ['id', 'mgmt']
df['id'] = df['id'].apply(lambda x: str(x).zfill(5))
df = df.set_index('id')
df.head()