Yeeun-Lee
Yeeun-Lee

Reputation: 11

Is it available using pandas in django?

I'm low-end web developer. I'm undergraduate and have started data-science academic group last semester. What I trying to build is "Web page of our group,which has 'leaderboard' " We did kind of self competition last semester(inspired by kaggle competition) and scored by comparing submitted csv file and answer.csv file(pandas, sklearn accuracy score)

So, here's my question

I made virtual env, built project under venv, and installed some pakages by venv/Scrips/~ pip install ~ (pandas, sklearn etc)

I'll add my Compete code in manage.py, I also built file field, I really wonder if I can open that file and score it.

class Compete(models.Model):
author = models.ForeignKey('auth.User', on_delete = models.CASCADE)
team = models.CharField(max_length = 200)
sub_date = models.DateField('submission date')
file = models.FileField(null = True)

def __str__(self):
    return self.team

Upvotes: 1

Views: 131

Answers (1)

quqa123
quqa123

Reputation: 675

To answer your question: Yes, it is possible to use pandas in Django. Most probably you will use it in your views.py ( dont forget to import pandas ). The view is just a backend to your app so you can do whatever you would do with a desktop python app. To simply open csv file and create dataframe, in your view you simply do:

df = pd.read_csv(file_path, encoding='utf-8')

Then process the dataframe and use pandas as you would normally do. Django is just a python web app framework which basically helps you implement your web application idea using python and all its greatness.

Upvotes: 2

Related Questions