Hi,
I wanted to ask how to load CSV data into the model. What steps do we have to follow?
I have made this function but how exactly to run this code because, python manage.py load data won't work.
def import_data():
with open('sample-dataset.csv') as f:
reader = csv.reader(f)
for row in reader:
if row[0] != 'user_id':
_, created = Funnel.objects.get_or_create(
user_id=row[0],
event=row[1],
timestamp=row[2],
session_id=row[3]
)
Now, how to run this script?