Pandas DataFrame: mode() function
DataFrame - mode() function
The mode() function is used to get the mode(s) of each element along the selected axis.
The mode of a set of values is the value that appears most often. It can be multiple values.
Syntax:
DataFrame.mode(self, axis=0, numeric_only=False, dropna=True)
Parameters:
Name | Description | Type/Default Value | Required / Optional |
---|---|---|---|
axis | The axis to iterate over while searching for the mode:
|
{0 or ‘index’, 1 or ‘columns’} Default Value: 0 |
Required |
numeric_only | If True, only apply to numeric columns. | bool Default Value: False |
Required |
dropna | Don’t consider counts of NaN/NaT. | bool Default Value: True |
Required |
Returns: DataFrame
The modes of each column or row.
Example:
Download the Pandas DataFrame Notebooks from here.
Previous: DataFrame - min() function
Next: DataFrame - pct_change() function
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/pandas/dataframe/dataframe-mode.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics