How to sum all price values having in count the quantity of each one Using pandas, I would like to sum all of the price to get the count value for each one. The Dataframe looks like this:

   price  quantity
0     25         2
1     20         3
2     20        -1


My code:

import pandas as pd

df = pd.DataFrame({'price': [25, 20, 20], 'quantity': [2, 3, -1]})
print(df)


So, I would expect the output to be something like $(25*2)+(20*3)+(20*-1)$: 

&gt;&gt;&gt; 90
You could always call on the pandas DataFrame's columns and work with that.

values = df['price'] * df['quantity']
sum(values)


if you want more information, I recommend https://stackoverflow.com/questions/14059094/i-want-to-multiply-two-columns-in-a-pandas-dataframe-and-add-the-result-into-a-n