- API reference
- Series
- pandas.Series.dot
pandas.Series.dot#
- Series.dot(other)[source]#
Compute the dot product between the Series and the columns of other.
This method computes the dot product between the Series and anotherone, or the Series and each columns of a DataFrame, or the Series andeach columns of an array.
It can also be called usingself @ other.
- Parameters:
- otherSeries, DataFrame or array-like
The other object to compute the dot product with its columns.
- Returns:
- scalar, Series or numpy.ndarray
Return the dot product of the Series and other if other is aSeries, the Series of the dot product of Series and each rows ofother if other is a DataFrame or a numpy.ndarray between the Seriesand each columns of the numpy array.
See also
DataFrame.dot
Compute the matrix product with the DataFrame.
Series.mul
Multiplication of series and other, element-wise.
Notes
The Series and other has to share the same index if other is a Seriesor a DataFrame.
Examples
>>>s=pd.Series([0,1,2,3])>>>other=pd.Series([-1,2,-3,4])>>>s.dot(other)8>>>s@other8>>>df=pd.DataFrame([[0,1],[-2,3],[4,-5],[6,7]])>>>s.dot(df)0 241 14dtype: int64>>>arr=np.array([[0,1],[-2,3],[4,-5],[6,7]])>>>s.dot(arr)array([24, 14])