Pandas DataFrame: dot() function
DataFrame - dot() function
The dot() function is used to compute the matrix multiplication between the DataFrame and other.
Syntax:DataFrame.dot(self, other)
Parameters:
Name | Description | Type/Default Value | Required / Optional |
---|---|---|---|
other | The other object to compute the matrix product with. |
Series, DataFrame or array-like | Required |
Returns: Series or DataFrame
If other is a Series, return the matrix product between self and other as a Serie. If other is a DataFrame or a numpy.array, return the matrix product of self and other in a DataFrame of a np.array.
Notes:
The dimensions of DataFrame and other must be compatible in order to compute the matrix multiplication. In addition, the column names of DataFrame and the index of other must contain the same values, as they will be aligned prior to the multiplication.
The dot method for Series computes the inner product, instead of the matrix product here.
Example:
Download the Pandas DataFrame Notebooks from here.
Previous: DataFrame - pow() function
Next: DataFrame - radd() function
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/pandas/dataframe/dataframe-dot.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics