You might want to use window functions
https://docs.djangoproject.com/en/3.0/ref/models/expressions/#window-functions
to calculate the sum per month. Haven't personally used them yet though.
--
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 django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3bb00f84-7a7c-408c-9b17-8cdd51f7bb1f%40googlegroups.com.
You might want to use window functions
https://docs.djangoproject.com/en/3.0/ref/models/expressions/#window-functions
to calculate the sum per month. Haven't personally used them yet though.
On 3/11/2020 8:27 AM, Mario Bisiani wrote:
Yes. I am using Chart.js. Any help?--
Il giorno giovedì 5 marzo 2020 13:42:18 UTC+1, krnrrr ha scritto:what do you mean by "cumulative"? if we have aggregate sums like
jan = 100
feb = 150
mar = 120
you want to have output as
jan = 100
feb = 250
mar = 370
?
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 django...@googlegroups.com.
import numpy as np
import datettime today = datetime.datetime.date() raw_data = MyModel.objects.filter('date'=today).values_list('a_number', flat=True)
cumsum = np.cumsum(raw_data)