Skip to content

Instantly share code, notes, and snippets.

View Mgmaplus's full-sized avatar

Daniel Andrade Mgmaplus

View GitHub Profile
@Mgmaplus
Mgmaplus / FromSpreadsheet.php
Created March 27, 2020 14:22
Barplot for #datacamplive
#Merge dataframes
all_sales_data = sales_date_customer.merge(employees_data, on = 'EmployeeName', how = 'left')
#New column CommissionEarned
all_sales_data['SalesCommission'] = all_sales_data['TotalDue'] * all_sales_data['CommissionPct']
#Grouping results by employee and year
commission_per_employee_per_year = all_sales_data.groupby(['OrderYear','EmployeeName']).sum()
#Sort and select with loc year 2012 results
commission_per_employee_per_year.sort_values(by='SalesCommission', ascending = True, inplace = True)