Django pandas is a tool for Pandas to work in Django. It requires Django model utils and Pandas as a dependencies.
Questions tagged [django-pandas]
11 questions
3
votes
1 answer
Django: Model Queryset to Pandas to Django Rest Framework
I am trying to accomplish the following workflow in my Django project:
Query my database
Convert the returned queryset to a pandas dataframe in order to perform some calculations & filtering
Pass the final dataframe to Django REST API…

Daniel
- 963
- 1
- 12
- 29
2
votes
2 answers
Pandas Dataframe apply custom function to certain rows with NULL columns
I have a Dataframe that looks like:
------------------------------
|Date | Deal | Country |
------------------------------
|2019-01-02 | ABC | US |
------------------------------
|2019-02-01 | ABC | US …

CodeSsscala
- 729
- 3
- 11
- 23
1
vote
2 answers
Pandas DataFrame table's styling in Django view
In a Django application I create a DataFrame, later on I transform it to html and pass to the view
table = df.to_html(index=False)
return render(request, 'results.html',{'table': table})
In results.html I add that table
{{ table|safe }}
And I get…

shelby
- 11
- 1
1
vote
2 answers
Django & Pandas: Get Choice Value in dataframe instead of Choice label
Again with a question regarding django... and pandas.
I'm trying to get the value of two 'choices' column into a pandas dataframe; however, I'm only getting the label of the choice.
Example code:
my_app/models.py
class Entry(models.Model):
…

Barranka
- 20,547
- 13
- 65
- 83
0
votes
0 answers
How to extract the string or name of all foreign keys used in a model in django-pandas dataframe
I have data stored in a Django Model/Table which I am fetching in pandas dataframe via django-pandas (Version: 0.6.6)
The model has 3 columns as foreign key viz: state_name, district_name and block_name
The model.py is…

Abhilash Singh Chauhan
- 291
- 3
- 16
0
votes
1 answer
DataFrame with DateTimeIndex from Django model
My goal is to create a pandas dataframe with a datetimeindex from a django model. I am using the django-pandas package for this purpose, specifically, the 'to_timeseries()' method.
First, I used the .values() method on my qs. This still returns a…

Malik A. Rumi
- 1,855
- 4
- 25
- 36
0
votes
2 answers
How to serialize a dataframe in django? Is there a way to return dataframe along with queryset in django?
What I'm trying to do here is get a query based on users' choices like date, group, and symbol.
I would like to convert this queryset to a data frame using django_pandas.
I tried to convert the data frame generated to JSON object but it gives some…

Anjaan
- 595
- 5
- 19
0
votes
1 answer
How to index a pandas dataframe by datetime?
I am using the django_pandas package to obtain a Pandas dataframe from stored Django models.
df = qs.to_dataframe(['time', 'price_open', 'price_high', 'price_low', 'price_close'], index='time')
Now I want to access the dataframe by a datetime,…

doKno
- 69
- 1
- 6
0
votes
1 answer
Django/Pandas - uploaded file gets 'MultiValueDictKeyError at /' followed by the entire database when I try to save the file to a form
I am new to Django and relatively new to python. I have written a program that allows a user to upload an excel file. The excel file is saved to a form in Django. I am unable to figure out how to save an uploaded file to my form after I run a script…

SKohlleffel
- 1
- 1
0
votes
1 answer
How to filter a dataframe by user inputs in Django filter?
I want to filter a dataframe that is pivoted from a model.
Model.py is:
class MTD(models.Model):
RGN = models.CharField(max_length = 60, db_column = 'RGN')
Channel = models.CharField(max_length = 60, db_column = 'Channel')
Vertical =…

Venugopal srinivasan
- 145
- 1
- 10
-3
votes
1 answer
ImportError: No module named 'django_pandas'
I installed numpy, but when I install django_pandas it gives me an error:
Using cached pandas-0.22.0.tar.gz
Could not find a version that satisfies the re
sions: 1.10.4, 1.11.0, 1.11.1rc1, 1.11.1, 1.11.2
.12.0rc1, 1.12.0rc2, 1.12.0,…