application_vnd.jupyter.stderr_output_3.png text_plain_output_2.png application_vnd.jupyter.stderr_output_1.png
from sklearn.preprocessing import MultiLabelBinarizer

import pandas as pd

df = pd.read_csv('../input/plant-pathology-2021-fgvc8/train.csv')
df['labels'] = df['labels'].apply(lambda string: string.split(' '))
s = list(df['labels'])
mlb = MultiLabelBinarizer()
trainx = pd.DataFrame(mlb.fit_transform(s), columns=mlb.classes_, index=df.index)
trainx.insert(0, 'image', df['image'], True)
trainx

t_df = pd.read_csv('../input/plant-pathology-2021-fgvc8/sample_submission.csv')
test_df = t_df.drop(['labels'], axis=1)
test_df