How to average and compress data using django?
<p>This class has volts &amp; frequency that are calculated every minute.
I want to take the average of each (volts, frequency ... etc) every 15 minutesof the recorded data and time ].</p>

<p>Should I do it in SQL or it can be done by django?</p>

<pre><code>class LogsN (models.Model):
    syv = models.ForeignKey (smodel.Syved, related_name='%(class)s')
    data = models.ForeignKey (smodel.Data, related_name='%(class)s')
    val = models.FloatField (null=True, blank = True)
    timestamp = models.DateTimeField ()
    objects = AccessManager()
</code></pre>

<p>I think you are looking for this
<a href="https://docs.djangoproject.com/en/1.10/topics/db/aggregation/" rel="nofollow">https://docs.djangoproject.com/en/1.10/topics/db/aggregation/</a></p>

<pre><code>LogsN.objects.all().aggregate(Avg('val'))
</code></pre>

python sql django aggregation