Python Forum
Python Pandas: How do I extract all the >1000 data from a certain column?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Pandas: How do I extract all the >1000 data from a certain column?
#1
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)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Why can't it extract the data from .txt well? Melcu54 4 1,822 Dec-12-2024, 07:36 PM
Last Post: Melcu54
  JSON File - extract only the data in a nested array for CSV file shwfgd 2 1,120 Aug-26-2024, 10:14 PM
Last Post: shwfgd
  Python script to extract data from API to database melpys 0 897 Aug-12-2024, 05:53 PM
Last Post: melpys
  Is it possible to extract 1 or 2 bits of data from MS project files? cubangt 8 3,853 Feb-16-2024, 12:02 AM
Last Post: deanhystad
  How do I calculate a ratio from 2 numbers and return an equivalent list of about 1000 Pleiades 8 21,177 Jan-05-2024, 08:30 PM
Last Post: sgrey
  Python Alteryx QS-Passing pandas dataframe column inside SQL query where condition sanky1990 0 1,409 Dec-04-2023, 09:48 PM
Last Post: sanky1990
  Returning Column and Row Data From Spreadsheet knight2000 0 1,122 Oct-22-2023, 07:07 AM
Last Post: knight2000
  Better python library to create ER Diagram by using pandas data frames as tables klllmmm 0 3,192 Oct-19-2023, 01:01 PM
Last Post: klllmmm
  Using pyodbc&pandas to load a Table data to df tester_V 3 2,941 Sep-09-2023, 08:55 PM
Last Post: tester_V
  pandas : problem with conditional filling of a column Xigris 2 1,452 Jul-22-2023, 11:44 AM
Last Post: Xigris

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020