<reponame>Pegasus-01/Data-manipulation-and-merging-with-pandas<filename>11-MergingDataframeWithPandas/Chapter_2/07-Slicing MultiIndexed DataFrames.py
# Sort the entries of medals: medals_sorted
medals_sorted = medals.sort_index(level=0)

# Print the number of Bronze medals won by Germany
print(medals_sorted.loc[('bronze','Germany')])

# Print data about silver medals
print(medals_sorted.loc['silver'])

# Create alias for pd.IndexSlice: idx
idx = pd.IndexSlice

# Print all the data on medals won by the United Kingdom
print(medals_sorted.loc[idx[:,'United Kingdom'],:])
MultiIndexed DataFrames.py
# Sort the entries of medals: medals_sorted
medals_sorted = medals.sort_index(level=0)

# Print the number of Bronze medals won by Germany
print(medals_sorted.loc[('bronze','Germany')])

# Print data about silver medals
print(medals_sorted.loc['silver'])

# Create alias for pd.IndexSlice: idx
idx = pd.IndexSlice

# Print all the data on medals won by the United Kingdom
print(medals_sorted.loc[idx[:,'United Kingdom'],:])
# Sort the entries of medals: medals_sorted # Print the number of Bronze medals won by Germany # Print data about silver medals # Create alias for pd.IndexSlice: idx # Print all the data on medals won by the United Kingdom