Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- df = pd.read_csv('YOUR_FILEPATH_HERE/BlackFriday.csv')
- #create a pivot table
- table = pd.pivot_table(df,values = 'Purchase', index=['Gender'],columns='Age',aggfunc=np.sum)
- #create a pivot table with nested index
- table1 = pd.pivot_table(df,values = 'Purchase', index=['Gender','City_Category'],columns='Age',aggfunc=np.mean)
Add Comment
Please, Sign In to add comment