← Imputation Exercise - Intro to Data Science

• 2 Followers
• 10 Lines

Get Embed Code x Embed video Use the following code to embed this video. See our usage guide for more details on embedding. Paste this in your document somewhere (closest to the closing body tag is preferable): ```<script type="text/javascript" src='https://amara.org/embedder-iframe'></script> ``` Paste this inside your HTML body, where you want to include the widget: ```<div class="amara-embed" data-url="http://www.youtube.com/watch?v=ZL4Sx0jFJRU" data-team="udacity"></div> ``` 4 Languages

Showing Revision 5 created 05/25/2016 by Udacity Robot.

1. All right, let's walk through the solution to
2. this guy. It's a pretty straightforward one line
3. solution. We simply say baseball weight equals baseball
4. weight.fillna numpy.mean baseball weight. What we're doing here
5. is saying let's compute the mean of all
6. the existing non NA values in baseball weight.
7. Then let's take all the NA's in baseball
8. weight. And replace them with this mean value.
9. Let's take the baseball weight column, and replace it with
10. this new column, which doesn't have any NA values in it.