In this lesson you’ll learn how you can remove columns from a Pandas DataFrame, which are not important for your analysis.
Slicing and Dicing a Pandas DataFrame
00:00 We have a bunch of data here. Not all of it is particularly useful, like, we always know that Kevin Durant in 2012 and 2013 played for OKC, so we don’t need to worry about this team and we really don’t care about who they’re playing against and whether they’re away or not. In this particular set, I’m interested in a few other things. Things like opponent are needed.
So I’m going to go ahead and delete those columns. All you do is simply call
DataFrame, and then the key for the column that you want to delete, and that’ll remove it from the dataset and we won’t have to deal with it anymore. So, as you can see here,
we have a more manageable dataset. I’m actually going to get rid of our
"Win/Lose" one as well, because I’m not interested in that as well either. We’re just looking particularly at Kevin Durant and when he does badly and when he does well. So we’re going to go ahead and do that. As you can see, we’ve moved the win/loss column from the dataset.
Become a Member to join the conversation.