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
  How to keep columns header on excel without change after export data to excel file? ahmedbarbary 0 346 May-03-2022, 05:46 PM
Last Post: ahmedbarbary
  Move a particular row in pandas data frame to last row klllmmm 0 1,230 Dec-27-2021, 09:11 AM
Last Post: klllmmm
  Sum the values in a pandas pivot table specific columns klllmmm 1 2,026 Nov-19-2021, 04:43 PM
Last Post: klllmmm
  Found input variables with inconsistent numbers of samples: [1000, 200] jenya56 2 1,562 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 1,021 Jul-17-2021, 09:09 AM
Last Post: JaneTan
  SaltStack: MySQL returner save less data into Database table columns xtc14 2 1,337 Jul-02-2021, 02:19 PM
Last Post: xtc14
  [Solved] Using readlines to read data file and sum columns Laplace12 4 1,774 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 4,409 Feb-22-2021, 06:51 PM
Last Post: eddywinch82
  Yahoo_fin, Pandas: how to convert data table structure in csv file detlefschmitt 14 5,044 Feb-15-2021, 12:58 PM
Last Post: detlefschmitt
  Pandas Extract data from two dataframe nio74maz 1 1,404 Dec-26-2020, 09:52 PM
Last Post: nio74maz

Forum Jump:

User Panel Messages

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