bigframes.pandas.DataFrame.mod#

DataFrame.mod(other: int | Series | DataFrame, axis: str | int = 'columns') DataFrame[source]#

Get modulo of DataFrame and other, element-wise (binary operator %).

Equivalent to dataframe % other. With reverse version, rmod.

Among flexible wrappers (add, sub, mul, div, mod, pow) to arithmetic operators: +, -, *, /, //, %, **.

Note

Mismatched indices will be unioned together.

Examples:

>>> df = bpd.DataFrame({
...     'A': [1, 2, 3],
...     'B': [4, 5, 6],
...     })

You can use method name:

>>> df['A'].mod(df['B'])
0    1
1    2
2    3
dtype: Int64

You can also use arithmetic operator %:

>>> df['A'] % (df['B'])
0    1
1    2
2    3
dtype: Int64
Parameters:
  • other โ€“ Any single or multiple element data structure, or list-like object.

  • axis ({0 or 'index', 1 or 'columns'}) โ€“ Whether to compare by the index (0 or โ€˜indexโ€™) or columns. (1 or โ€˜columnsโ€™). For Series input, axis to match Series index on.

Returns:

DataFrame result of the arithmetic operation.

Return type:

bigframes.pandas.DataFrame