import pandas as pd df = pd.read_csv(RESOURCE_ROOT + '/data_files/102018_core_business.csv')
for index, row in df.iterrows(): business_instance, created = Business.objects.get_or_create(business_id=row['id'], business_name=row['name']) On Monday, October 15, 2018 at 3:12:45 PM UTC+4, Mohammad Aqib wrote: > > I have multiple .csv files to create data from django models into a > database using python pandas library. Can anyone suggest me how to do > perform this task. > > import pandas as pd > > df = pd.read_csv(RESOURCE_ROOT + '/data_files/102018_core_business.csv') > > business_instance, created = > Business.objects.get_or_create(business_id=df['id'], business_name=df['name']) > > > -- > Mohd Aqib > Software Engineer > 9873141865 > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2a230c66-5723-4c9d-a1c7-63f86711f8ac%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

