@@ -2063,16 +2063,53 @@ def autocorr(self, lag=1):
2063
2063
2064
2064
def dot (self , other ):
2065
2065
"""
2066
- Matrix multiplication with DataFrame or inner-product with Series
2067
- objects. Can also be called using `self @ other` in Python >= 3.5.
2066
+ Compute the dot product between the Series and the columns of other.
2067
+
2068
+ This method computes the dot product between the Series and another
2069
+ one, or the Series and each columns of a DataFrame, or the Series and
2070
+ each columns of an array.
2071
+
2072
+ It can also be called using `self @ other` in Python >= 3.5.
2068
2073
2069
2074
Parameters
2070
2075
----------
2071
- other : Series or DataFrame
2076
+ other : Series, DataFrame or array-like
2077
+ The other object to compute the dot product with its columns.
2072
2078
2073
2079
Returns
2074
2080
-------
2075
- dot_product : scalar or Series
2081
+ scalar, Series or numpy.ndarray
2082
+ Return the dot product of the Series and other if other is a
2083
+ Series, the Series of the dot product of Series and each rows of
2084
+ other if other is a DataFrame or a numpy.ndarray between the Series
2085
+ and each columns of the numpy array.
2086
+
2087
+ See Also
2088
+ --------
2089
+ DataFrame.dot: Compute the matrix product with the DataFrame.
2090
+ Series.mul: Multiplication of series and other, element-wise.
2091
+
2092
+ Notes
2093
+ -----
2094
+ The Series and other has to share the same index if other is a Series
2095
+ or a DataFrame.
2096
+
2097
+ Examples
2098
+ --------
2099
+ >>> s = pd.Series([0, 1, 2, 3])
2100
+ >>> other = pd.Series([-1, 2, -3, 4])
2101
+ >>> s.dot(other)
2102
+ 8
2103
+ >>> s @ other
2104
+ 8
2105
+ >>> df = pd.DataFrame([[0 ,1], [-2, 3], [4, -5], [6, 7]])
2106
+ >>> s.dot(df)
2107
+ 0 24
2108
+ 1 14
2109
+ dtype: int64
2110
+ >>> arr = np.array([[0, 1], [-2, 3], [4, -5], [6, 7]])
2111
+ >>> s.dot(arr)
2112
+ array([24, 14])
2076
2113
"""
2077
2114
from pandas .core .frame import DataFrame
2078
2115
if isinstance (other , (Series , DataFrame )):
0 commit comments