I have a pandas dataframe where column 1 is my file_path and column 2 is my label. Is it possible to sort the images into new directories based on the value of the labels. I am using 3 labels so the value is either 0, 1, 2.
dataframe = pd.read_csv('\\extension.csv', header = True)
if dataframe.iat[0,1] == 0:
if not os.path.exists(dest_fold_0):
os.mkdir(dest_fold_0)
img.save(dest_fold_0 + dataframe.iat[1, 0], 'jpeg')
DataFrame example:
File_Extension,Labels
['\\test_0000_50x50.jpg'],0
['\\test_0001_50x50.jpg'],1
['\\test_0002_50x50.jpg'],0
['\\test_0003_50x50.jpg'],1
['\\test_0004_50x50.jpg'],2
['\\test_0005_50x50.jpg'],0
['\\test_0006_50x50.jpg'],1