← Courses

Pandas, Hands-On Data with Python

Data Science

Core pandas · Lesson 7 of 10

Data types and missing values

Types and missing data

Two things trip up every new analyst: data types and missing values.

  • Every column has a type, its dtype: whole numbers, decimals, text, and so on. Check them with df.dtypes.
  • Missing values show up as NaN. Find them with isnull(), and handle them with fillna() or dropna().
Python

Whether to drop missing data or fill it is a real judgment call you make as the analyst.

Exercise

Exercise — check your understanding

The scores DataFrame has a missing value. Replace every missing value with 0 and store the new DataFrame in fixed.

You’re reading for free. Sign in to keep your progress and earn a certificate when you finish.Sign in to keep my progress →