I have a directory containing many images(*.jpg). Each image has a name. In the same directory i have a file containing python code(below).
import numpy as np
import pandas as pd
import glob
fd = open('melanoma.csv', 'a')
for img in glob.glob('*.jpg'):
dataFrame = pd.read_csv('allcsv.csv')
name = dataFrame['name']
for i in name:
#print(i)
if(i+'.jpg' == img):
print(i)
In the same directory i have another file(allcsv.csv) containing large amount of csv data for all images in the directory and many other images also. The above code compares the names of images with the name column in the allcsv.csv file and prints the names. I need to modify this code to write all the data in a row of the compared images into a file named 'melanoma.csv'.
eg:
allcsv.csv
name,age,sex
ISIC_001,85,female
ISIC_002,40,female
ISIC_003,30,male
ISIC_004,70,female
if the folder has the images only for ISIC_002 and ISIC_003
melanoma.csv
name,age,sex
ISIC_002,40,female
ISIC_003,30,male