ECON 3209 · Week 4, Lecture 3 · Kerala Agricultural University
Autumn 2026
By the end of this lecture, you will be able to:
StringIOStringIO lets us treat text like a CSV fileNaNNA may need explicit cleaning.isna() identifies missing values cell by cell-999 or 99 for missing datafillna() replaces missing values using a chosen ruledropna() removes rows or columns with missing valuespd.to_numeric() converts them safelyIn econometrics, data cleaning is not “boring preparation” — it is part of the research design.
pd.read_excel("file.xlsx")sheet_name= and skiprows=Create a DataFrame with columns district, yield_kg, and deposit_crore.
yield_kg.fillna() with the column mean.yield_tonnes.StringIO is a convenient way to simulate CSV loading in class.isna(), fillna(), and dropna() support missing-data workflowsECON 3209 — Kerala Agricultural University