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
  Is it possible to extract 1 or 2 bits of data from MS project files? cubangt 8 945 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 15,446 Jan-05-2024, 08:30 PM
Last Post: sgrey
  Python Alteryx QS-Passing pandas dataframe column inside SQL query where condition sanky1990 0 690 Dec-04-2023, 09:48 PM
Last Post: sanky1990
  Returning Column and Row Data From Spreadsheet knight2000 0 413 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 991 Oct-19-2023, 01:01 PM
Last Post: klllmmm
  Using pyodbc&pandas to load a Table data to df tester_V 3 748 Sep-09-2023, 08:55 PM
Last Post: tester_V
  Why can't it extract the data from .txt well? Melcu54 3 646 Aug-20-2023, 10:07 PM
Last Post: deanhystad
  pandas : problem with conditional filling of a column Xigris 2 594 Jul-22-2023, 11:44 AM
Last Post: Xigris
  Database that can compress a column, or all data, automatically? Calab 3 1,120 May-22-2023, 03:25 AM
Last Post: Calab
  Code for pullng all data in a column EmBeck87 5 1,051 Apr-03-2023, 03:43 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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