loading
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from ExtendedDataFrame import ExtendedDataFrame

# generate data
columns =   ["name",   "grade", "teacher"] 
students = [
  ["Darla",  "A",     "Frizzle"],
  ["Rajiv",  "B",     "Puff"   ],
  ["Malika", "C",     "Frizzle"],
  ["Henry",  "A",     "Frizzle"],
  ["Jin",    "B",     "Puff"],
  ["Ariel",  None,    None]
]

# ExtendedDataFrame accepts the same arguments that
# DataFrame does
students = ExtendedDataFrame(students, columns=columns)

# dropna() -> regular DataFrame method
# select_by_grade_and_teacher() -> custom method
# column selection -> regular DataFrame method, returns a Series
top_frizz = (students
             .dropna()
             .select_by_grade_and_teacher("A", "Frizzle")
             ["name"]
)

print(top_frizz)