Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def fillDatabase():
- df = pd.read_excel("/Users/farmaceut/Sites/journals_database/journals.xlsx", header=[2, 3])
- df = df.replace(np.nan, '', regex=True)
- for col in df.columns[8:]:
- Domain.objects.update_or_create(domain_name=col[0])
- print("DOMAIN")
- for index, col in df.iterrows():
- print("ITERROWS")
- obj, created = Journal.objects.update_or_create(title=col[1], abbreviation=col[4], impact_factor=0,
- ministerial_points=col[7])
- i = 8
- for cell in col[i:51]:
- if cell == 'x':
- column_name = df.columns[i][0]
- obj.domain.add(column_name)
- i = i + 1
Add Comment
Please, Sign In to add comment