From the course: Data Analysis with Python and Pandas

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Solution: The select() function

Solution: The select() function

- [Instructor] All right, our solution code is up on the right. Let's go ahead and walk through this in the notebook. Alright, so we needed to create a holiday bonus column and then sum the total value of that column. Let's go ahead and set up our NumPy Select. So we have our conditions and we want our conditions to be a list of conditions. Our first condition is going to be all days in December, so our month is going to equal 12. (keyboard clicks) All right, and our next condition is month equals five, and day of week equals six. (keyboard clicks) This will get us Sundays in May. Let's go ahead and wrap our individual conditions in parentheses here. And then our next condition is very similar. So let's just go ahead and grab this one and change the pieces that we need to. So this next one is going to be July. So month seven and it's going to be Monday, which is zero. And so we have our conditions, and now we need to set up our choices, which are going to be our holiday names. So…

Contents