Ayush_Agarwal:

df[‘image_name’].apply(lambda x:os.path.isfile(img_path + x + img_ext)).all() self.mlb=MultiLabelBinarizer() self.img_path=img_path self.img_ext=img_ext self.transform=transform self.Xtrain=df[‘image_name’] + self.img_ext


In the above quoted lines, df remains as a pandas DataFrame, therefore, self.Xtrain will be Pandas-Series. I tried the following with a similar dataframe:
>>> img_ext = '.jpg'
>>> X = df['filename'] + img_ext
>>> print(X[:5])
0    353640_00M22.jpg
1    353640_00M22.jpg
2    353640_00M22.jpg
3    353640_00M22.jpg
4    353640_00M22.jpg
Name: filename, dtype: object


>>> type(X)
pandas.core.series.Series

So, if you want to change that, you can use df[image_name].values + img_ext:
>>> X = df['filename'].values + img_ext
>>> type(X)
numpy.ndarray

Also, note that this line does not o any thing:
df['image_name'].apply(lambda x:os.path.isfile(img_path + x + img_ext)).all()

If you want, you have to assign it:
df['image_name'] = df['image_name'].apply(lambda x:os.path.isfile(img_path + x + img_ext)).all()