data example pivot table

Example 1: pivot table pandas

df.pivot_table(['int_age'],index = [df.iloc[:,meet_friends], df.iloc[:,friendsgiving]])

Example 2: pivot table sql

SELECT SalesAgent AS PivotSalesAgent, India, US, UK FROM tblAgentsSales
PIVOT 
(
	SUM(SalesAmount) FOR SalesCountry IN (India, US, UK)
)
AS testPivotTable


SELECT SalesAgent GrpBySalesAgent, SalesCountry, SUM(SalesAmount) Sales 
from tblAgentsSales 
GROUP BY SalesAgent, SalesCountry


select SalesAgent TableSalesAgent, SalesCountry, SalesAmount 
from tblAgentsSales