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
#7
I want to better understand the example you provided.. without providing more examples.. Why am i not able to get the calculations of the registers that are up? What portion of the logic should i focus on within the example portion of this "# Compute what % of registers are offline"

I tried adding a "Up" column and it complained about "Length mismatch: Expected axis has 3 elements, new values have 4 elements"
I tried to create a new set of logic and just renamed the variables and status to Up, but no luck.

I appreciate all the help, but id like to see if i can figure it out, but need a little push on where to focus in this logic:

# Compute what % of registers are online
by_store = statusResults.groupby("Store")
statusUp = by_store["Status"]
report = pd.concat([statusUp.size(), statusUp.sum()], axis=1).reset_index()
report.columns = ["Store", "Register Count", "Up"]
report["Up"] = report["Up"] / report["Register Count"] * 100
print("Register Status Report Up", report, sep="\n")
Reply


Messages In This Thread
RE: Filter data into new dataframe as main dataframe is being populated - by cubangt - Oct-22-2023, 08:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  renaming a column without a name in a dataframe Carbonpony 2 911 Jan-23-2025, 08:20 AM
Last Post: Carbonpony
  dataframe merge gunther 2 590 Jan-22-2025, 05:23 PM
Last Post: Pedroski55
  Running search/replace across Polars dataframe columns efficiently hobbycoder 3 2,260 Oct-28-2024, 03:18 AM
Last Post: hobbycoder
  Most efficient way to roll through a pandas dataframe? sawtooth500 2 1,133 Aug-28-2024, 10:08 AM
Last Post: Alice12
  Confused by the different ways of extracting data in DataFrame leea2024 1 685 Aug-17-2024, 01:34 PM
Last Post: deanhystad
  docx file to pandas dataframe/excel iitip92 1 2,592 Jun-27-2024, 05:28 AM
Last Post: Pedroski55
  FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries sawtooth500 14 8,044 Apr-24-2024, 01:42 AM
Last Post: sawtooth500
  Elegant way to apply each element of an array to a dataframe? sawtooth500 7 2,666 Mar-29-2024, 05:51 PM
Last Post: deanhystad
  Dataframe copy warning sawtooth500 4 2,213 Mar-25-2024, 11:38 PM
Last Post: sawtooth500
  FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries i sawtooth500 3 17,656 Mar-22-2024, 03:08 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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