Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier.
Dataframe.dot() works similarly like
mul() method, but instead of returning multiplied separate values, Dot product is returned (Sum of multiplication of values at each index).
other: Other Series to be used to calculate DOT product
Return type: Series with updated values
In this example, two series are created from Python lists using Pandas
Series() method. Method is then called on series1 and series2 is passed as parameter. The result is then stored in a variable and displayed.
Dot product = 93
The elements in caller series are multiplied with the element at same index in passed series. All the multiplied values are then added to get the dot product.
As in above example, the series are:
[7, 5, 6, 4, 9] [1, 2, 3, 10, 2] Dot product = 7*1 + 5*2 + 6*3 + 4*10 + 9*2 = 7 + 10 + 18 + 40 + 18 = 93
- Python | pandas.map()
- Python | Pandas TimedeltaIndex.contains
- Python | Pandas dataframe.ne()
- Python | Pandas.to_datetime()
- Python | Pandas Series.str.contains()
- Python | Pandas Series.dt.day
- Python | Pandas Series.min()
- Python | Pandas DataFrame.ix[ ]
- Python | Pandas Series.max()
- Python | Pandas dataframe.mul()
- Python | Pandas Series.dt.second
- Python | Pandas Series.sem()
- Python | Pandas Timestamp.tz
- Python | Pandas.apply()
- Python | Pandas dataframe.mod()
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.