Practice #11 Boolean indexing
import pandas as pd
df = pd.read_excel("E12EXAMPLE.xlsx")
df.head(3)
| Name | Subject | Phone | |
|---|---|---|---|
| 0 | Louis | Korean | 010-6138-6625 |
| 1 | Harvey | Japanese | 010-2901-3320 |
| 2 | G-dragon | Chinese | 010-5132-3850 |
pdf = df.pivot_table("Name", index="Subject", aggfunc="count")
pdf
a1 = pdf.loc[pdf["Name"]<10].index
df.loc[df["Subject"].isin(a1)].to_clipboard(index=False)