Skip to content

Instantly share code, notes, and snippets.

@allatambov
Created March 24, 2020 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allatambov/5281c4f22485e312d8fad7873af526d2 to your computer and use it in GitHub Desktop.
Save allatambov/5281c4f22485e312d8fad7873af526d2 to your computer and use it in GitHub Desktop.
import pandas as pd
hp = pd.read_excel("HP_one.xlsx")
hp.head()
hp_pivot = hp.pivot_table(index='Name', columns='Subject', values = 'Mark')
hp_pivot
hp.pivot(index='Name', columns='Subject', values = 'Mark')
hp_pivot.index
hp_pivot.columns
hp.pivot_table(index='Name')
hp.pivot_table(index='Name', columns='Subject')
hp_pivot.loc["Ronald Weasley", 'Potions']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment