Here we calculate using aggregate
>>> avg = Book.objects.aggregate(average_price=Avg('price'))
{'average_price': 34.35}
But why we don’t use below concept in above.
a = Books.objects.all()
Avg = sum([x.price for x in a])/len(a)
34.35
I want to know use aggregate rather than second procees.