<jupyter_start><jupyter_text>create a Pivot table with multiple indexes<jupyter_code>df = pd.read_excel('SaleData.xlsx')
df.head()
pd.pivot_table(df,index=["Region","SalesMan"])<jupyter_output><empty_output><jupyter_text>create a Pivot table and find the total sale amount region wise, manager wise<jupyter_code>pd.pivot_table(df,index = ["Region","Manager"], values = ["Sale_amt"],aggfunc=np.sum)<jupyter_output><empty_output><jupyter_text>create a Pivot table and find the total sale amount region wise, manager wise, sales man wise<jupyter_code>pd.pivot_table(df,index=["Region","Manager","SalesMan"], values="Sale_amt", aggfunc=np.sum)<jupyter_output><empty_output><jupyter_text>create a Pivot table and find the item wise unit sold<jupyter_code>pd.pivot_table(df,index=["Item"], values="Units", aggfunc=np.sum)<jupyter_output><empty_output><jupyter_text>find the region wise total sale.<jupyter_code>pd.pivot_table(df,index="Region",values="Sale_amt", aggfunc = np.sum)<jupyter_output><empty_output><jupyter_text>region wise, item wise unit sold<jupyter_code>pd.pivot_table(df,index=["Region", "Item"], values="Units", aggfunc=np.sum)<jupyter_output><empty_output><jupyter_text>create a Pivot table and count the manager wise sale and mean value of sale amount<jupyter_code>pd.pivot_table(df,index=["Manager"],values=["Sale_amt"],aggfunc=[np.mean,len])<jupyter_output><empty_output><jupyter_text>create a Pivot table and find manager wise, salesman wise total sale and also display the sum of all sale amount at the bottom<jupyter_code>table = pd.pivot_table(df,index=["Manager","SalesMan"],values=["Units","Sale_amt"],
               aggfunc=[np.sum],fill_value=0,margins=True)

table<jupyter_output><empty_output><jupyter_text>create a Pivot table and find the total sale amount region wise, manager wise, sales man wise where Manager = "Douglas"<jupyter_code>table = pd.pivot_table(df,index=["Region","Manager","SalesMan"], values="Sale_amt")
table
table.query('Manager == ["Douglas"]')<jupyter_output><empty_output><jupyter_text>create a Pivot table and find the region wise Television and Home Theater sold<jupyter_code>table = pd.pivot_table(df,index=["Region", "Item"], values="Units")
table
table.query('Item == ["Television","Home Theater"]')<jupyter_output><empty_output><jupyter_text>create a Pivot table and find the minimum sale value of the items<jupyter_code>table = pd.pivot_table(df, index='Item', values='Sale_amt', aggfunc=np.min)
table<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13815261044176708, 'fraction_numerical': 0.00040160642570281126, 'mean_word_length': 10.071111111111112, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '625394', 'license': 'MIT', 'n_tokens_mistral': 869, 'n_tokens_neox': 860, 'n_words': 173, 'path': 'Pandas_Exercise_PivotTable.ipynb', 'repo_name': 'yaozeliang/pandas_share', 'size': '2490'}