Python Forum
Python Pandas: How do I average ONLY the data >1000 from several columns?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Pandas: How do I average ONLY the data >1000 from several columns?
#1
I am new to pandas. I just want to average the revenue from Revenue1 to Revenue3 that are > 1000. The dataframe will have other numerical columns like Income. Thank you!

Input:

|Name | Revenue1| Revenue2| Revenue3| Income |
|Peter| 1000 | 2000 | 3000 | 100 |
|Jane | 9000 | 10000 | 5000 | 200 |

Desired Output:

| Name | Average |
| Peter | 2500 |
| Jane | 8000 |

Peter =average (2000+ 3000) = 2500
Jane =average (9000+ 10000 +5000) = 8000
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
  Python Pandas: How do I extract all the >1000 data from a certain column? JaneTan 0 298 Jul-17-2021, 09:09 AM
Last Post: JaneTan
  SaltStack: MySQL returner save less data into Database table columns xtc14 2 378 Jul-02-2021, 02:19 PM
Last Post: xtc14
  [Solved] Using readlines to read data file and sum columns Laplace12 4 506 Jun-16-2021, 12:46 PM
Last Post: Laplace12
  Pandas: how to split one row of data to multiple rows and columns in Python GerardMoussendo 4 1,728 Feb-22-2021, 06:51 PM
Last Post: eddywinch82
  Yahoo_fin, Pandas: how to convert data table structure in csv file detlefschmitt 14 2,369 Feb-15-2021, 12:58 PM
Last Post: detlefschmitt
  Pandas Extract data from two dataframe nio74maz 1 601 Dec-26-2020, 09:52 PM
Last Post: nio74maz
  How to fill parameter with data from multiple columns CSV file greenpine 1 491 Dec-21-2020, 06:50 PM
Last Post: Larz60+
  Sorting data into columns pprod 0 932 Nov-18-2020, 06:20 PM
Last Post: pprod
  How to groupby Months showing average order value - Pandas & matplotlib Rwood90 0 560 Oct-20-2020, 12:53 PM
Last Post: Rwood90

Forum Jump:

User Panel Messages

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