Skip to content

Commit

Permalink
Updated documentation to clearly state the behavior of aggregate majo…
Browse files Browse the repository at this point in the history
…rity/minority
  • Loading branch information
suricactus authored and nyalldawson committed Mar 30, 2020
1 parent 27d99db commit f8897d8
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 20 deletions.
12 changes: 6 additions & 6 deletions python/core/auto_generated/qgsstatisticalsummary.sip.in
Expand Up @@ -263,20 +263,20 @@ or via setStatistics.

double minority() const;
%Docstring
Returns minority of values. The minority is the value with least occurrences in the list
Returns minority of values. The minority is the value with least occurrences in the list.
This is only calculated if Statistic.Minority has been specified in the constructor
or via setStatistics. A NaN value may be returned if the minority cannot
be calculated.
or via setStatistics. If multiple values match, return the first value relative to the
initial values order. A NaN value may be returned if the minority cannot be calculated.

.. seealso:: :py:func:`majority`
%End

double majority() const;
%Docstring
Returns majority of values. The majority is the value with most occurrences in the list
Returns majority of values. The majority is the value with most occurrences in the list.
This is only calculated if Statistic.Majority has been specified in the constructor
or via setStatistics. A NaN value may be returned if the majority cannot
be calculated.
or via setStatistics. If multiple values match, return the first value relative to the
initial values order. A NaN value may be returned if the minority cannot be calculated.

.. seealso:: :py:func:`minority`
%End
Expand Down
14 changes: 12 additions & 2 deletions python/core/auto_generated/qgsstringstatisticalsummary.sip.in
Expand Up @@ -219,14 +219,24 @@ Returns the mean length of strings.

QString minority() const;
%Docstring
Returns the least common string.
Returns the least common string. The minority is the value with least occurrences in the list
This is only calculated if Statistic.Minority has been specified in the constructor
or via setStatistics. If multiple values match, return the first value relative to the
initial values order.

.. seealso:: :py:func:`majority`

.. versionadded:: 3.14
%End

QString majority() const;
%Docstring
Returns the most common string.
Returns the most common string. The majority is the value with most occurrences in the list
This is only calculated if Statistic.Majority has been specified in the constructor
or via setStatistics. If multiple values match, return the first value relative to the
initial values order.

.. seealso:: :py:func:`minority`

.. versionadded:: 3.14
%End
Expand Down
12 changes: 6 additions & 6 deletions src/core/qgsstatisticalsummary.h
Expand Up @@ -241,19 +241,19 @@ class CORE_EXPORT QgsStatisticalSummary
int variety() const { return mValueCount.count(); }

/**
* Returns minority of values. The minority is the value with least occurrences in the list
* Returns minority of values. The minority is the value with least occurrences in the list.
* This is only calculated if Statistic::Minority has been specified in the constructor
* or via setStatistics. A NaN value may be returned if the minority cannot
* be calculated.
* or via setStatistics. If multiple values match, return the first value relative to the
* initial values order. A NaN value may be returned if the minority cannot be calculated.
* \see majority
*/
double minority() const { return mMinority; }

/**
* Returns majority of values. The majority is the value with most occurrences in the list
* Returns majority of values. The majority is the value with most occurrences in the list.
* This is only calculated if Statistic::Majority has been specified in the constructor
* or via setStatistics. A NaN value may be returned if the majority cannot
* be calculated.
* or via setStatistics. If multiple values match, return the first value relative to the
* initial values order. A NaN value may be returned if the minority cannot be calculated.
* \see minority
*/
double majority() const { return mMajority; }
Expand Down
20 changes: 14 additions & 6 deletions src/core/qgsstringstatisticalsummary.h
Expand Up @@ -198,15 +198,23 @@ class CORE_EXPORT QgsStringStatisticalSummary
double meanLength() const { return mMeanLength; }

/**
* Returns the least common string.
* \since QGIS 3.14
*/
* Returns the least common string. The minority is the value with least occurrences in the list
* This is only calculated if Statistic::Minority has been specified in the constructor
* or via setStatistics. If multiple values match, return the first value relative to the
* initial values order.
* \see majority
* \since QGIS 3.14
*/
QString minority() const { return mMinority; }

/**
* Returns the most common string.
* \since QGIS 3.14
*/
* Returns the most common string. The majority is the value with most occurrences in the list
* This is only calculated if Statistic::Majority has been specified in the constructor
* or via setStatistics. If multiple values match, return the first value relative to the
* initial values order.
* \see minority
* \since QGIS 3.14
*/
QString majority() const { return mMajority; }

/**
Expand Down

0 comments on commit f8897d8

Please sign in to comment.