## Pandas Tutorial

Pandas HOME Pandas Intro Pandas Getting Started Pandas Series Pandas DataFrames Pandas Read CSV Pandas Read JSON Pandas Analyzing Data

## Cleaning Data

Cleaning Data Cleaning Empty Cells Cleaning Wrong Format Cleaning Wrong Data Removing Duplicates

## Correlations

Pandas Correlations

Pandas Plotting

## Quiz/Exercises

Pandas Editor Pandas Quiz Pandas Exercises Pandas Certificate

## References

DataFrames Reference

# Pandas DataFrame dot() Method

### Example

Multiply values from one DataFrame with values from another DataFrame, and add them together:

import pandas as pd

df1 = pd.DataFrame([[1, 2], [3, 4]])
df2 = pd.DataFrame([[5, 6], [7, 8]])

print(df1.dot(df2))
Try it Yourself »

## Definition and Usage

The `dot()` method multiplies each value from one DataFrame with the values from another DataFrame (or Series or array), and adds them together.

### Example Explained:

Assume you have these two DataFrame objects:

[[1, 2], [3, 4]]

[[5, 6], [7, 8]]

Multiply the values from the first DataFrame with the values from the second DataFrame, one by one like this:

1 * 5 = 5
2 * 7 = 14

Summarize the two products:

5 + 14 = 19

19 will be the first value in the result.

Here you can see the calculation for each value in the result:

(1 * 5) + (2 * 7) = 19
(1 * 6) + (2 * 8) = 22
(3 * 5) + (4 * 7) = 43
(3 * 6) + (4 * 8) = 50

which will result in a DataFrame object like this::

[[19, 22], [43, 50]]

## Syntax

dataframe.dot(other)

## Parameters

Parameter Description
other Required. A number, list of numbers, or another object with a data structure that fits with the original DataFrame.

## Return Value

A DataFrame with the results.

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.