From the course: Python Data Analysis
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 - Python Tutorial
From the course: Python Data Analysis
Filling missing values
- [Instructor] We pick up where we left and load temperature data for Pasadena, California using our getweather module. This is a time series, a sequence of values, organized chronologically, usually with equal cadence, that is the same time interval between every two consecutive samples. To get a sense of the data, one of them begins by computing its average value and perhaps its extreme, the minimum and maximum. With NumPy, we can use mean, min, and max. But wait, in this case, we seem to get NaNs. What's going on? It shouldn't be surprising, if we remember that the data contains missing values, which are indeed represented as NaNs. And NaNs can't really participate in any mathematical operation, NaN plus one is still NaN. In fact, how many do we have? The NumPy function isnan, creates a Boolean array of NaN-ness, so to speak. We can then count the instances of true in this array by using a neat trick. If we do…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.