text_html_output_1.png
from glob import glob

import os

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

train_df = pd.DataFrame([dict(path=c_path, image_name=os.path.basename(c_path), type_cat=os.path.basename(os.path.dirname(c_path))) for c_path in glob('../input/train/*/*')])
train_df.sample(3)

test_df = pd.DataFrame([dict(path=c_path, image_name=os.path.basename(c_path)) for c_path in glob('../input/test/*')])
test_df.sample(3)

guess_df = test_df[['image_name']]
w_values = pd.value_counts(train_df['type_cat']) / train_df.shape[0]
for col, val in sorted(w_values.to_dict().items()):
    guess_df[col] = val
guess_df.sample(3)