Python Forum
Python Pandas: How do I extract all the >1000 data from a certain column? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Python Pandas: How do I extract all the >1000 data from a certain column? (/thread-34306.html)



Python Pandas: How do I extract all the >1000 data from a certain column? - JaneTan - Jul-17-2021

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

table3=table1[(table1['Revenue'] >1000)]
table3['Revenue'].sum(axis=0)