Python statistics.mode() method is **“used to calculate the mode (central tendency) of the given numeric or nominal data set.”**

**Syntax**

`statistics.mode(data)`

**Parameters**

**data:** It is required. The data values to be used (can be any sequence, list, or iterator.

**Example 1: How to Use Python statistics.mode() Method**

```
import statistics
listA = [19, 21, 46, 19, 18, 19]
print(statistics.mode(listA))
```

In the above code, the **number 19 **is frequently appearing. So that is our mode.

**Output**

**Example 2**

The **mode** is the **statistical** term that refers to the most frequently occurring number found in a set of numbers. The **mode** is detected by collecting and organizing data to count the frequency of each result.

```
import statistics
listUnique = [19, 21, 18, 30, 46]
print(statistics.mode(listUnique))
```

The above list has unique elements inside the list. So mode does not work here. Instead, it will give us an error.

**Output**

**Example 3**

To calculate the tuple’s mode, pass it as a parameter to the mode() function, and it will return the mode of data.

```
import statistics
data = (21, 19, 18, 46, 30, 18, 19, 21, 18)
print(statistics.mode(data))
```

**Output**

That’s it.

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.