From the course: Python in Excel: Getting Started with Data Analysis

Unlock the full course today

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

Solution: DataFrames

Solution: DataFrames

(bright music) - [Instructor] All right, let's take a look at the code I used to solve these challenges. So for the first challenge, we needed to calculate the number of bands that were in each musical genre. So this can be calculated directly using the Value Counts function. So I just used the Value Counts function on the band's DataFrame that I've created, and you can see that that returns the number of values for each one of the different genres that I've passed in as the argument here to Value Counts. So that's pretty straightforward. For the second part of the challenge, we needed to implement a Text Search function. So the value in cell F4 is the term we needed to search for within the name of each band. And remember, if the value is empty, we return all the bands. So let's take a look at that code. And I'll expand this out so we can see it. So my code uses the Excel function to get the search term from the cell F4. So if that cell is empty and the value is none, then I just…

Contents