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
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework