From the course: Python Data Analysis
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Cleaning weather data - Python Tutorial
From the course: Python Data Analysis
Cleaning weather data
- [Instructor] We pick up where we left and load temperature data for Pasadena, California. 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 its extreme, the minimum and the maximum. With NumPy, we use mean, min, and max. But wait, we get nans. What's going on here? Some values are missing from the data file, and indeed they're represented as nans. I can see some here. Now, the mean of a sequence that includes a nan is going to be, well, a nan. In fact, how many values are missing? The NumPy function is nan, creates a Boolean array of nans. We can then count the instances of true values here by using a neat trick. If it were arithmetic with Booleans in Python, they are converted to integers with false counting as zero and true as one. It follows that we can count the trues in a Boolean…