- In mathematics, a dot product of two sequences is given by:
x.y = Sum(x1.y1 + x2.y2+…+xnyn)
- A pandas Series is a one-dimensional sequence built using numpy.ndarray and bundled with numerous methods to perform computing and data analysis.
- The dot product of two pandas series objects can be computed using the Series.dot() method.
# Example program to perform dot product
# between two pandas series objects
import pandas as pds
# Create pandas.Series objects
series1 = pds.Series([1, 0, 5]);
series2 = pds.Series([2, 1, 2]);
# Obtain dot product of two pandas Series objects
series3 = series1.dot(series2);
print("Dot product of Series1 and Series2");
Dot product of Series1 and Series2