I have csv like this,
name,job
Jay,engineer
Kay,layer
hop,warrior
then I load this in pandas datafrme and put in DB
df = pd.read_csv('job.csv')
for index,row in df.iterrows():
q = Issue(name = row[0],job = row[1])
q.save()
print ("Register : ",row[0] , " / ",row[1])
exit()
It works well but now, I want to generalize this code as function like this below.
def stor_db(classname):
df = pd.read_csv(classname + '.csv')
for index,row in df.iterrows():
q = `classname`(
`title[0]ofdf` = row[0],
`title[1]ofdf` = row[1])
q.save()
print ("Register : ",row[0] , " / ",row[1])
exit()
I need to dynamically make variable/class name.
It possible for python and pandas??