Thursday, January 22, 2026
HomeLanguagesPython | Pandas Series.prod()

Python | Pandas Series.prod()

Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier.

Pandas Series.prod() method is used to get the product of the values for the requested axis.

Syntax: Series.prod(axis=None, skipna=None, level=None, numeric_only=None, min_count=0)

Parameters:
axis : {index (0)}
skipna[boolean, default True] : Exclude NA/null values. If an entire row/column is NA, the result will be NA
level[int or level name, default None] : If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
numeric_only[boolean, default None] : Include only float, int, boolean data. If None, will attempt to use everything, then use only numeric data

Returns: Return the product of the values for the requested axis

Code #1: By default, product of an empty or all-NA Series is 1.




# importing pandas module 
import pandas as pd 
  
# min_count = 0 is the default
pd.Series([]).prod()
  
# When passed  min_count = 1, 
# product of an empty series will be NaN
pd.Series([]).prod(min_count = 1)


Output:

1.0
nan

 

Code #2:




# importing pandas module 
import pandas as pd 
  
# applying prod() on a list of series
val = pd.Series([12, 5, 7]).prod() 
  
val


Output:

420
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32475 POSTS0 COMMENTS
Milvus
119 POSTS0 COMMENTS
Nango Kala
6847 POSTS0 COMMENTS
Nicole Veronica
11977 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12064 POSTS0 COMMENTS
Shaida Kate Naidoo
6986 POSTS0 COMMENTS
Ted Musemwa
7220 POSTS0 COMMENTS
Thapelo Manthata
6933 POSTS0 COMMENTS
Umr Jansen
6912 POSTS0 COMMENTS