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
  Found input variables with inconsistent numbers of samples: [1000, 200] jenya56 2 148 Sep-15-2021, 12:48 PM
Last Post: jenya56
  Build a matrix by pressing buttons of an interface in Tkinter which extract data from juandiegopulla 1 147 Sep-13-2021, 07:28 PM
Last Post: deanhystad
  Python Pandas: How do I average ONLY the data >1000 from several columns? JaneTan 0 320 Jul-17-2021, 01:34 PM
Last Post: JaneTan
  Pandas DataFrame combine rows by column value, where Date Rows are NULL rhat398 0 480 May-04-2021, 10:51 PM
Last Post: rhat398
  Need help on extract dynamic table data Dr_Strange 0 724 Apr-30-2021, 07:03 AM
Last Post: Dr_Strange
  Python modules to extract data from a graph? bigmit37 5 14,789 Apr-09-2021, 02:15 PM
Last Post: TysonL
  Add a new column when I extract each sheet in an Excel workbook as a new csv file shantanu97 0 612 Mar-24-2021, 04:56 AM
Last Post: shantanu97
  Pandas: how to split one row of data to multiple rows and columns in Python GerardMoussendo 4 1,727 Feb-22-2021, 06:51 PM
Last Post: eddywinch82
  Yahoo_fin, Pandas: how to convert data table structure in csv file detlefschmitt 14 2,368 Feb-15-2021, 12:58 PM
Last Post: detlefschmitt
  How to filter out Column data From Multiple rows data? firaki12345 10 1,327 Feb-06-2021, 04:54 AM
Last Post: buran

Forum Jump:

User Panel Messages

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