How to display most frequent value in a Pandas series? Improve Improve Like Article Like Save Share Report In this article, our basic task is to print the most frequent value in a series. We can find the number of occurrences of elements using the value_counts() method. From that the most frequent element can be accessed by using the mode() method. Example 1 : # importing the module import pandas as pd # creating the series series = pd.Series(['g', 'e', 'e', 'k', 's', 'f', 'o', 'r', 'g', 'e', 'e', 'k', 's']) print("Printing the Original Series:") display(series) # counting the frequency of each element freq = series.value_counts() print("Printing the frequency") display(freq) # printing the most frequent element print("Printing the most frequent element of series") display(series.mode()); Output : Example 2 : Replacing the every element except the most frequent element with None. # importing the module import pandas as pd # creating the series series = pd.Series(['g', 'e', 'e', 'k', 's', 'f', 'o', 'r', 'g', 'e', 'e', 'k', 's']) # counting the frequency of each element freq = series.value_counts() # replacing everything else as Other series[~series.isin(freq .index[:1])] = None print(series) Output : Last Updated : 18 Aug, 2020 Like Article Save Article Previous Check if a column starts with given string in Pandas DataFrame? Next Set Pandas dataframe background Color and font color in Python Share your thoughts in the comments Add Your Comment Please Login to comment... Similar Reads Add a Pandas series to another Pandas series Pandas Series dt.weekofyear Method | Get Week of Year in Pandas Series Pandas Series dt.minute | Extract Minute from DateTime Series in Pandas Pandas Series dt.dayofweek | Get Day of Week from DateTime Series in Pandas Pandas Series dt.freq | Retrieve Frequency of Pandas Time Series Pandas Series dt.daysinmonth | Get Number of Days in Month in Pandas Series Pandas Series dt.normalize() | Normalize Time in Pandas Series Find the most frequent value in a NumPy array Find the k most frequent words from data set in Python Python | Find most frequent element in a list Like H hupphurr Follow Article Tags : Python Pandas-exercise Python pandas-series Python-pandas Python Practice Tags : python