Python Forum
Filter data into new dataframe as main dataframe is being populated
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Filter data into new dataframe as main dataframe is being populated
#4
What im trying to accomplish is to get a few calculation values returned to me.

I need to get a count of registers down by store and if the "%" is greater than "x%" then save that off into a new df

example:

Store 7 has a total of 8 registers, only 1 is down, that is 13% Not required in the df
Store 13 has a total of 15 registers, only 3 are down, but that is 20% which is over the % threshold so this would be added to the df
and so on.

Since the master result set that is saved into a csv contained the IP, Store, Register, Status and Datetime, the master df has everything needed to calculate the % by store.

My test from above using this line:
registercntbystore = registerBreakdown.groupby(['Store'])['Register'].count()
Gives me a df with all stores and the total count by store.

Cant get my head wrapped around how to use everything together in order to get a df with ONLY records that are over the % threshold. The purpose is that this will need to also be saved into a CSV for our support team to work on or contact the stores to find out what is wrong.
Reply


Messages In This Thread
RE: Filter data into new dataframe as main dataframe is being populated - by cubangt - Oct-22-2023, 04:25 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries sawtooth500 14 1,126 Apr-24-2024, 01:42 AM
Last Post: sawtooth500
  Elegant way to apply each element of an array to a dataframe? sawtooth500 7 570 Mar-29-2024, 05:51 PM
Last Post: deanhystad
  Dataframe copy warning sawtooth500 4 485 Mar-25-2024, 11:38 PM
Last Post: sawtooth500
  FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries i sawtooth500 3 2,177 Mar-22-2024, 03:08 AM
Last Post: deanhystad
  Adding PD DataFrame column bsben 2 390 Mar-08-2024, 10:46 PM
Last Post: deanhystad
  Python Alteryx QS-Passing pandas dataframe column inside SQL query where condition sanky1990 0 810 Dec-04-2023, 09:48 PM
Last Post: sanky1990
  Comparing Dataframe to String? RockBlok 2 484 Nov-24-2023, 04:55 PM
Last Post: RockBlok
  DataFRame.concat() nafshar 3 840 Jul-14-2023, 04:41 PM
Last Post: nafshar
  Convert dataframe from str back to datafarme Creepy 1 700 Jul-07-2023, 02:13 PM
Last Post: snippsat
  Question on pandas.dataframe merging two colums shomikc 4 909 Jun-29-2023, 11:30 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

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