MCPcopy
hub / github.com/ormar-orm/ormar / avg

Method avg

ormar/queryset/queryset.py:862–872  ·  view source on GitHub ↗

Returns avg value of columns for rows matching the given criteria (applied with `filter` and `exclude` if set before). :return: avg value of columns :rtype: Union[int, float, list]

(self, columns: Union[str, list[str]])

Source from the content-addressed store, hash-verified

860 return await self._query_aggr_function(func_name="sum", columns=columns)
861
862 async def avg(self, columns: Union[str, list[str]]) -> Any:
863 """
864 Returns avg value of columns for rows matching the given criteria
865 (applied with `filter` and `exclude` if set before).
866
867 :return: avg value of columns
868 :rtype: Union[int, float, list]
869 """
870 if not isinstance(columns, list):
871 columns = [columns]
872 return await self._query_aggr_function(func_name="avg", columns=columns)
873
874 async def update(self, each: bool = False, **kwargs: Any) -> int:
875 """

Callers 5

test_avg_methodFunction · 0.45
test_queryset_methodFunction · 0.45
aggregationsFunction · 0.45
avgFunction · 0.45

Calls 1

_query_aggr_functionMethod · 0.95

Tested by 4

test_avg_methodFunction · 0.36
test_queryset_methodFunction · 0.36
avgFunction · 0.36