I want to create loop that automatically outputs one table/chart per index. In this case, I only want one index out of the two below. Further, I don't want to even show the first index in the output... I want that index hidden behind the scenes...
Here's the data:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
table = {'Name': ["Joe", "Joe", "Joe","Jane","Jane"],
'Stf Sch Vp Area': ["Org2","Org1","Org2","Org1","Org2"],
'Snapshot': ["Feb 2015","Mar 2015","April 2015","Feb 2016","Feb 2016"],
'Job Type': ["RBE","RBE","Temp","RBE","Temp"],
'EE Count' :[1,1,1,1,1]}
df_table = pd.DataFrame(table, columns=['Name', 'Stf Sch Vp Area', 'EE Count', 'Snapshot','Job Type'])
df_table
Here's the table:
pivot_table = pd.pivot_table(df_table, index=['Stf Sch Vp Area', 'Snapshot'], values=['EE Count'], columns='Job Type', aggfunc= [np.sum])
And here's the chart:
pivot_table.plot.bar(figsize=[16,10], stacked=False)
But I don't want to show the Org in the table. Rather, I want to use some type of lambda/loop to automatically output each distinct Org into a new chart. Thus, I'd like an output that would automatically product two charts.
Any thoughts?