def dot(self, other):
from pandas.core.frame import DataFrame<EOL>if isinstance(other, (Series, DataFrame)):<EOL><INDENT>common = self.index.union(other.index)<EOL>if (len(common) > len(self.index) or<EOL>len(common) > len(other.index)):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>left = self.reindex(index=common, copy=False)<EOL>right = other.reindex(index=common, copy=False)<EOL>lvals = left.values<EOL>rvals = right.values<EOL><DEDENT>else:<EOL><INDENT>lvals = self.values<EOL>rvals = np.asarray(other)<EOL>if lvals.shape[<NUM_LIT:0>] != rvals.shape[<NUM_LIT:0>]:<EOL><INDENT>raise Exception('<STR_LIT>' %<EOL>(lvals.shape, rvals.shape))<EOL><DEDENT><DEDENT>if isinstance(other, DataFrame):<EOL><INDENT>return self._constructor(np.dot(lvals, rvals),<EOL>index=other.columns).__finalize__(self)<EOL><DEDENT>elif isinstance(other, Series):<EOL><INDENT>return np.dot(lvals, rvals)<EOL><DEDENT>elif isinstance(rvals, np.ndarray):<EOL><INDENT>return np.dot(lvals, rvals)<EOL><DEDENT>else:  <EOL><INDENT>raise TypeError('<STR_LIT>' % type(other))<EOL><DEDENT>
Compute the dot product between the Series and the columns of other.

This method computes the dot product between the Series and another
one, or the Series and each columns of a DataFrame, or the Series and
each columns of an array.

It can also be called using `self @ other` in Python >= 3.5.

Parameters
----------
other : Series, 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 a
    Series, the Series of the dot product of Series and each rows of
    other if other is a DataFrame or a numpy.ndarray between the Series
    and 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 Series
or a DataFrame.

Examples
--------
>>> s = pd.Series([0, 1, 2, 3])
>>> other = pd.Series([-1, 2, -3, 4])
>>> s.dot(other)
8
>>> s @ other
8
>>> df = pd.DataFrame([[0, 1], [-2, 3], [4, -5], [6, 7]])
>>> s.dot(df)
0    24
1    14
dtype: int64
>>> arr = np.array([[0, 1], [-2, 3], [4, -5], [6, 7]])
>>> s.dot(arr)
array([24, 14])