Data Slicing in Python with Mito

Understanding Data with Pivot Tables and Visualization Tools

To gain insights from the data, it's essential to understand its relationships and patterns. One effective way to do this is by using pivot tables. A pivot table allows us to transform and reorganize our data into a more meaningful format, making it easier to analyze.

One of the first steps in creating a pivot table is to determine what values we want to use for each dimension and measurement. In this case, we decided to add "Ratings" as both the row and column headers, with "Type" being left out. We chose to aggregate the ratings by using the count function, which allowed us to see the total number of movies or TV shows in each rating category.

By creating a pivot table in this way, we can quickly generate the equivalent code that represents the same data structure. This is especially useful when working with large datasets, as it allows us to reuse and build upon existing code. For example, if we wanted to filter down our data to only include movies with a specific rating, we could use the generated code to do so.

Another powerful tool in the MitO analysis environment is the ability to create visualizations on top of our pivot tables. By using the graph button, we can represent our data graphically and gain a deeper understanding of its relationships and patterns. In this case, we used a bar chart to compare the frequency of different rating categories across movies.

By zooming in and out of our visualization, we can get a more detailed look at specific subsets of the data. This allows us to identify trends and behaviors that might not be immediately apparent from the overall dataset. For example, if we wanted to focus on a particular country or region, we could use the zoom feature to examine its data in greater detail.

Another way to gain insights from our data is by filtering it down to specific subsets based on certain criteria. In this case, we used the filter function to remove all movies with a rating other than TV-14. This allowed us to focus on only those titles that met our specific criteria.

By applying filters and examining our data in different ways, we can uncover new patterns and relationships that might not have been apparent from the original dataset. For example, if we wanted to see how many movies or TV shows were produced by a particular country, we could create a pivot table with "Country" as both the row and column headers, and use the count function to aggregate the data.

By manipulating our data in this way, we can gain a deeper understanding of its structure and content. We can identify trends and patterns that might be hidden from view, and make more informed decisions based on our analysis. By using tools like pivot tables and visualization, we can unlock new insights and perspectives on our data, and explore the complex relationships between different variables.

The generated code for each filter and manipulation is also an essential part of this process. By being able to see the equivalent code that represents our data structure, we can build upon existing code and reuse it in new and creative ways. This allows us to work more efficiently and effectively with large datasets, and to explore new possibilities for analysis and insight.

In conclusion, pivot tables and visualization tools are powerful tools for understanding and analyzing data. By using these tools to transform and reorganize our data, we can gain a deeper understanding of its structure and content. We can identify trends and patterns that might be hidden from view, and make more informed decisions based on our analysis. With the ability to create equivalent code and manipulate data in different ways, we can unlock new insights and perspectives on our data, and explore the complex relationships between different variables.

"WEBVTTKind: captionsLanguage: enhey this is jake from mido thanks for checking out this video i'm going to show you how you can really easily slice and dice and transform your data using the mito python package so the first thing we're going to do is run these two lines of code here so import miter sheet and my do sheet dot sheet and that's going to render our mito front end so the miter front end what it is is it's a spreadsheet front end for python inside the jupyter notebook so every edit we make in this front end here is going to generate the equivalent python below the first thing let's do is just get our data in so we can get data in one of two ways one is we can just search our local files here i'm going to decide this uh netflix csv file so with some data about the different things you can watch on netflix so we'll do that and we see when we do that it populates the miter sheet with our data from this netflix csv file and below it generates the code that's turned that csv into a data frame the other way we can get data into the tool is we can pass in a data frame directly so you can call in the miter sheet at any point your analysis if you're working with data frames above all you have to do is pass in the name of the data frame as an argument to this minor sheet.sheetcall and it'll populate the sheet before we move forward just ways you can actually analyze and understand your data using mido let me just show you how you can install it really quickly so all you have to do is these three commands here from our documentation we're going to install the mito installer then run the install command from within the installer and then just open jupyter lab and you're good to go so back in mido we have some data that is about the different titles the different things you can watch on netflix so there's tv shows and movies obviously let's look at some summary statistics really quickly for the breakdown between tv shows and movies just to understand our data better i'll go to the summary stats tab here we can see we have a good amount more movies we see the exact number there five three seven seven uh more movies and tv shows we can see and the other data point i'm interested in here is the rating so what these movies and tv shows are rated again i'm going to look at the summary stats for those here we can see tvma tv 14 and tvpg are the most common ratings and again we can see the exact values for each of them on those labels that pop up so what i want to do here now is just understand the relationship a bit better to really slice and dice my data in a way that gives me some insights so i'm going to do a pivot table which is a great way to do that i'll click pivot first thing i can do here is i'm going to add the ratings as my row and as the columns i'm not going to put the type so it's either going to be tv show or movie and as the value i'll just select ratings again and just put the aggregation type as count and what that does there is it populates this here so i'll close this pivot table now and now we've made this really great um editable updating pivot table inside my own so we can see for example the rating tv 14 the netflix profile has 1272 movies that have that rating and 659 tv shows that have that rating and again as i said before everything we do here is generating the equivalent code below so when i make this pivot table below it generates the code that is the that represents this exact same pivot table so if we were to just do this by hand it would generate this same pivot table here um and what i can do here is really nice about the generated code is i can use that carry forward in my analysis so this is all real code i can use so i can run this cell here and now this pivot table is called df2 as we can see here if i were to print out df2 right here we would see the same pivot table that we have in the cell above here another thing i might want to do to really understand my data and you know help transform and help decide how i want to analyze more is put a graph on top of this represent this graphically so what i can do here is just click our graph button here let's just look at the ratings of the movies versus the different ratings so i'm going to put ratings on the x-axis and on the y-axis i'm going to put the movie ratings here and we can see oh oops i'll just closed that let me do it again x-axis rating y-axis movie and we can see here tbma for the movies is the most common rating tv 14 second most common tv are third most common and tv pg fourth most common one thing i can do here just if i want to zoom in and look at a subset of the data get a better understanding of the compare and contrast here i can zoom in on a smaller set and then all i have to do is double tap and get back out to the larger data set so let's go back to the base data set and look at another relationship understand our data even more slice and dice it up a little bit more we see here we have the different countries these are the countries that the data sets are coming from in the bottom right corner i can see here i have 7787 rows in here and now if i apply a filter to country and let's say i just want to look at the ones that are from brazil so i'll do contains brazil we can see we filtered our data set down just to the brazil values or where where or values that contain brazil in it and below if i go here we see we've generated the equivalent code for that filter and we'll also see that there are 88 values left in the data set so we can see that we've shrunk the data set a good amount by filtering down to that filtering down to the brazil values i can remove that filter as well so let me remove that here and we're back to the base data set and let's look let's say i want to look at i want to see how many values how many movies or slash tv shows i have from each country all i have to do is pivot again actually i'll go back to this pivot table here and i can edit it so i'm going to change this here to to country i'm going to get rid of this and i'm going to change this to country and count and now here i can see for each country what is the amount of titles we have from there and if i want to make this a bit easier to view i'll hit change this to descending order and so now i can see united states has the most india the second most united kingdom the third most et cetera et cetera and below we have again the code for that pivot table and we have the code for that sword we did that sorting and descending order um so there's a lot of great analysis we can do in the tool mito is a really great way to slice and dice your data look at different patterns look at different behaviors in the data and understand how you want to proceed with the data thanks for checking out the video hope you really enjoyed ithey this is jake from mido thanks for checking out this video i'm going to show you how you can really easily slice and dice and transform your data using the mito python package so the first thing we're going to do is run these two lines of code here so import miter sheet and my do sheet dot sheet and that's going to render our mito front end so the miter front end what it is is it's a spreadsheet front end for python inside the jupyter notebook so every edit we make in this front end here is going to generate the equivalent python below the first thing let's do is just get our data in so we can get data in one of two ways one is we can just search our local files here i'm going to decide this uh netflix csv file so with some data about the different things you can watch on netflix so we'll do that and we see when we do that it populates the miter sheet with our data from this netflix csv file and below it generates the code that's turned that csv into a data frame the other way we can get data into the tool is we can pass in a data frame directly so you can call in the miter sheet at any point your analysis if you're working with data frames above all you have to do is pass in the name of the data frame as an argument to this minor sheet.sheetcall and it'll populate the sheet before we move forward just ways you can actually analyze and understand your data using mido let me just show you how you can install it really quickly so all you have to do is these three commands here from our documentation we're going to install the mito installer then run the install command from within the installer and then just open jupyter lab and you're good to go so back in mido we have some data that is about the different titles the different things you can watch on netflix so there's tv shows and movies obviously let's look at some summary statistics really quickly for the breakdown between tv shows and movies just to understand our data better i'll go to the summary stats tab here we can see we have a good amount more movies we see the exact number there five three seven seven uh more movies and tv shows we can see and the other data point i'm interested in here is the rating so what these movies and tv shows are rated again i'm going to look at the summary stats for those here we can see tvma tv 14 and tvpg are the most common ratings and again we can see the exact values for each of them on those labels that pop up so what i want to do here now is just understand the relationship a bit better to really slice and dice my data in a way that gives me some insights so i'm going to do a pivot table which is a great way to do that i'll click pivot first thing i can do here is i'm going to add the ratings as my row and as the columns i'm not going to put the type so it's either going to be tv show or movie and as the value i'll just select ratings again and just put the aggregation type as count and what that does there is it populates this here so i'll close this pivot table now and now we've made this really great um editable updating pivot table inside my own so we can see for example the rating tv 14 the netflix profile has 1272 movies that have that rating and 659 tv shows that have that rating and again as i said before everything we do here is generating the equivalent code below so when i make this pivot table below it generates the code that is the that represents this exact same pivot table so if we were to just do this by hand it would generate this same pivot table here um and what i can do here is really nice about the generated code is i can use that carry forward in my analysis so this is all real code i can use so i can run this cell here and now this pivot table is called df2 as we can see here if i were to print out df2 right here we would see the same pivot table that we have in the cell above here another thing i might want to do to really understand my data and you know help transform and help decide how i want to analyze more is put a graph on top of this represent this graphically so what i can do here is just click our graph button here let's just look at the ratings of the movies versus the different ratings so i'm going to put ratings on the x-axis and on the y-axis i'm going to put the movie ratings here and we can see oh oops i'll just closed that let me do it again x-axis rating y-axis movie and we can see here tbma for the movies is the most common rating tv 14 second most common tv are third most common and tv pg fourth most common one thing i can do here just if i want to zoom in and look at a subset of the data get a better understanding of the compare and contrast here i can zoom in on a smaller set and then all i have to do is double tap and get back out to the larger data set so let's go back to the base data set and look at another relationship understand our data even more slice and dice it up a little bit more we see here we have the different countries these are the countries that the data sets are coming from in the bottom right corner i can see here i have 7787 rows in here and now if i apply a filter to country and let's say i just want to look at the ones that are from brazil so i'll do contains brazil we can see we filtered our data set down just to the brazil values or where where or values that contain brazil in it and below if i go here we see we've generated the equivalent code for that filter and we'll also see that there are 88 values left in the data set so we can see that we've shrunk the data set a good amount by filtering down to that filtering down to the brazil values i can remove that filter as well so let me remove that here and we're back to the base data set and let's look let's say i want to look at i want to see how many values how many movies or slash tv shows i have from each country all i have to do is pivot again actually i'll go back to this pivot table here and i can edit it so i'm going to change this here to to country i'm going to get rid of this and i'm going to change this to country and count and now here i can see for each country what is the amount of titles we have from there and if i want to make this a bit easier to view i'll hit change this to descending order and so now i can see united states has the most india the second most united kingdom the third most et cetera et cetera and below we have again the code for that pivot table and we have the code for that sword we did that sorting and descending order um so there's a lot of great analysis we can do in the tool mito is a really great way to slice and dice your data look at different patterns look at different behaviors in the data and understand how you want to proceed with the data thanks for checking out the video hope you really enjoyed it\n"