Guest User

Untitled

a guest
Jan 22nd, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. df = pd.read_csv('YOUR_FILEPATH_HERE/BlackFriday.csv')
  2. #create a pivot table
  3. table = pd.pivot_table(df,values = 'Purchase', index=['Gender'],columns='Age',aggfunc=np.sum)
  4.  
  5. #create a pivot table with nested index
  6. table1 = pd.pivot_table(df,values = 'Purchase', index=['Gender','City_Category'],columns='Age',aggfunc=np.mean)
Add Comment
Please, Sign In to add comment