From the course: Data Ingestion with Python

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Filling missing values

Filling missing values - Python Tutorial

From the course: Data Ingestion with Python

Start my 1-month free trial

Filling missing values

Missing values are not strictly an error but many algorithms don't work well with missing data. There's a difference between missing data and empty or zero value. Sometimes it's hard to know the difference. In our example is the snow measurement of zero coming from a missing measurement? or there was actually no snow that day. You should know your data and know the difference. Lucky for you Panda is great for dealing with missing data. Panda supports missing values in floats with NAN Not a Number and for timestamp it has NAT Not a time. There is also experimental support for missing integer data in the new integer array type. NAN is defining the floating-point specification and it's a funny value. Let's have a look. So, let's import numpy as np and pandas as pd. in np we have np.nan you can also create a new one with float.nan. nan does not equal itself. So, np.nan equals np.nan and it doesn't equal itself. Need to use a special function such as pd.isnull(np.nan) and then you will get…

Contents