Python | Pandas dataframe.mod() Last Updated : 03 Nov, 2022 Comments Improve Suggest changes Like Article Like Report 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 dataframe.mod() function returns modulo of dataframe and other, element-wise (binary operator mod). This function is essentially same as the Dataframe % other, but with support to substitute a fill_value for missing data in one of the inputs. This function can be used with either a series or a dataframe. Syntax: DataFrame.mod(other, axis='columns', level=None, fill_value=None) Parameters : Other : Series, DataFrame, or constant axis : For Series input, axis to match Series index on level : Broadcast across a level, matching Index values on the passed MultiIndex level fill_value : Fill existing missing (NaN) values, and any new element needed for successful DataFrame alignment, with this value before computation. If data in both corresponding DataFrame locations is missing the result will be missingReturns : result : DataFrame Example #1: Use mod() function to find the modulo of each value in the dataframe with a constant. Python3 # importing pandas as pd import pandas as pd # Creating the dataframe df = pd.DataFrame({"A":[12, 4, 5, 44, 1], "B":[5, 2, 54, 3, 2], "C":[20, 16, 7, 3, 8], "D":[14, 3, 17, 2, 6]}) # Print the dataframe df Lets use the dataframe.mod() function to find the modulo of dataframe with 3 Python3 # find mod of dataframe values with 3 df.mod(3) Output : Example #2: Use mod() function to find the modulo with a series over the column axis. Python3 # importing pandas as pd import pandas as pd # Creating the dataframe df = pd.DataFrame({"A":[12, 4, 5, 44, 1], "B":[5, 2, 54, 3, 2], "C":[20, 16, 7, 3, 8], "D":[14, 3, 17, 2, 6]}) # Print the dataframe df Let's create the series object Python3 # create a series sr = pd.Series([3, 2, 4, 5]) # setting its column index similar to the dataframe sr.index =["A", "B", "C", "D"] # print the series sr Lets use the dataframe.mod() function to find the modulo of dataframe with series Python3 # find mod of dataframe values with series # axis = 1 indicates column axis df.mod(sr, axis = 1) Output : Comment More infoAdvertise with us Next Article Python | Pandas dataframe.mod() S Shubham__Ranjan Follow Improve Article Tags : Technical Scripter Python Python-pandas Python pandas-dataFrame Pandas-DataFrame-Methods +1 More Practice Tags : python Similar Reads Python | Pandas dataframe.div() 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 dataframe.div() is used to find the floating division of the dataframe and other 3 min read Python | Pandas dataframe.mask() 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 dataframe.mask() function return an object of same shape as self and whose corr 3 min read Python | Pandas dataframe.floordiv() 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 dataframe.floordiv() function is used for integer division of the dataframe with 2 min read Python | Pandas dataframe.eval() 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 dataframe.eval() function is used to evaluate an expression in the context of t 2 min read Python | Pandas dataframe.pow() 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 dataframe.pow() function calculates the exponential power of dataframe and othe 3 min read Python | Pandas Dataframe.pop() The pop() method in Pandas is used to remove a column from a DataFrame and return it as a Series. This is similar in concept to the dictionary pop() method in Python, but specifically designed for use with Pandas DataFrames. It's key features include:Removes a specified column from a DataFrame.Retur 2 min read Python | Pandas dataframe.std() 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 dataframe.std() function return sample standard deviation over requested axis. 2 min read Python | Pandas dataframe.rmod() 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 dataframe.rmod() function is used for finding the modulo of dataframe and other 2 min read Python | Pandas dataframe.insert() Pandas insert method allows the user to insert a column in a data frame or series(1-D Data frame). A column can also be inserted manually in a data frame by the following method, but there isn't much freedom here. For example, even column location can't be decided and hence the inserted column is al 8 min read Python | Pandas dataframe.rmul() 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 dataframe.rmul() function is used for finding the multiplication of dataframe a 2 min read Like