Answers for "aggregation with f() in django rest api"

0

aggregation with f() in django rest api

>>> from django.db.models import Avg, Count
>>> Book.objects.annotate(num_authors=Count('authors')).aggregate(Avg('num_authors'))
{'num_authors__avg': 1.66}
Posted by: Guest on February-23-2021

Python Answers by Framework

Browse Popular Code Answers by Language