Jul-17-2021, 09:09 AM
Hi
I am new to pandas. For Revenue, I just want to extract all Revenue !>1000, and sum all the extracted data.
**Input:**
|Name | Revenue|
|Peter| 10000 |
|Jane | 20000 |
|Sally| 30000 |
**Output:**
| Revenue|
| 20000 |
| 30000 |
Ans=2000+ 30000 = 5000
Currently, I can obtain the results with the below code. But is there a more elegant way of doing it? Sorry if the query is simple. I am still learning pandas. Thank you
I am new to pandas. For Revenue, I just want to extract all Revenue !>1000, and sum all the extracted data.
**Input:**
`|Name | Revenue|
|Peter| 10000 |
|Jane | 20000 |
|Sally| 30000 |
`**Output:**
`| Revenue|
| 20000 |
| 30000 |
Ans=2000+ 30000 = 5000
`Currently, I can obtain the results with the below code. But is there a more elegant way of doing it? Sorry if the query is simple. I am still learning pandas. Thank you
table3=table1[(table1['Revenue'] >1000)] table3['Revenue'].sum(axis=0)