Python Forum
Need help on group by function.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help on group by function.
#1
Hi Guru's,

i am beginner of Python. i am struck with converting "R" script(below) into Python.

total_sales = sum(transactions['PureSales'])

job_roles <- transactions %>%
group_by(JobRole,job_classification) %>%
summarise(
     order_lines = n(),
     prop_order_lines = order_lines/nrow(transactions),
    orders = n_distinct(OrderNumber),
    sales = sum(PureSales),
    prop_sales = sum(PureSales)/total_sales
  ) %>%
ungroup
Could you please help, i can i write same code in python?


thanks a bunch in advance.

Sree.
Reply


Messages In This Thread
Need help on group by function. - by Sree - Mar-06-2018, 06:11 PM
RE: Need help on group by function. - by nilamo - Mar-06-2018, 06:42 PM
RE: Need help on group by function. - by wavic - Mar-07-2018, 02:00 AM

Forum Jump:

User Panel Messages

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