Analysts often get data as extracts: CSV files pulled from the EHR. In pandas each file becomes a DataFrame:
import pandas as pd
encounters = pd.read_csv("encounters.csv")
Then check what you have before you count anything:
encounters.shape gives (rows, columns).
encounters.dtypes shows each column's type. Dates read from a CSV arrive as text (object) until you convert them with pd.to_datetime.
encounters["encounter_type"].value_counts() counts each value.
Each exercise here starts with the extracts it needs already loaded, under the table's name without hd_: encounters, patients, labs.