Publish AI, ML & data-science insights to a global community of data professionals.

Mito – Part 1: An Introduction: A Python Package Which Will Improve And Speed Up Your Analysis!

Mito is a Python package which allows the user to complete their analysis in Python at much faster speeds! The user will create a…

Mito is a Python package which allows the user to complete their analysis in Python at much faster speeds! The user will create a Mitosheet which then generates the Python code for them after manipulation of the sheet. Today we will simply look at what Mito is and how to install it in Python with an additional short example. This is the first of a collection of posts directed towards understading how to work with a Mitosheet and its interactions within a dataset.

Photo by Campaign Creators on Unsplash
Photo by Campaign Creators on Unsplash

What is Mito?

Mito is a Python package that can help data scientists perform quicker analyses. It can be implemented within a Jupyter Notebook where the user will create a Mito spreadsheet a.k.a. a Mitosheet. The best part about Mito? All the user has to do is manipulate the Mitosheet and the python code is created for them! Say goodbye to constantly having to search stack exchange or code documentation for various tasks in your project!


How to install Mito?

I used the following code in a Jupyter Notebook to install Mito. Before installing, ensure you read and understand the terms of service and privacy policy. First, you must ensure you are running Python 3.6 or above.

import sys
sys.version

I installed Mito using Python 3.8.3. After verification of the Python version, I installed the package through my Anaconda command prompt. You will want to ensure you are in the correct virtual environment for installing Mito (find out how to install a virtual environment here). Once working in the correct environment, use the following code to install Mito.

python -m pip install mitoinstaller

Once the package is downloaded, run the installer.

python -m mitoinstaller install

After that code finishes running, open your Jupyter Notebook and import Mito!

import mitosheet

Example

As I previously mentioned, the Mito package will provide Python code for you when you manipulate a spreadsheet. This example will simply show you how the code is generated and a more in-depth review of Mito’s capabilities will be provided at a later date. The dataset used is the List of Animation Studios dataset from kaggle.com. First, we want to create a Mitosheet.

mitosheet.sheet()

Running this code will create the following popup in Jupyter notebook (after accepting the terms and conditions).

Image: Mitosheet in Jupyter (Image from Author)
Image: Mitosheet in Jupyter (Image from Author)

Next, click the "import" button to import the dataset into the notebook.

Image: Import Button (Image from Author)
Image: Import Button (Image from Author)

Now that the dataset is imported, we can begin to manipulate the spreadsheet to generate code. Notice how the code has already been started for us!

Image: Mitosheet with Data (Image form Author)
Image: Mitosheet with Data (Image form Author)

Now, to add to this example, let us say we want to filter the data by country. First, click the delta sign in the country column of the spreadsheet.

Image: Selecting a Column (Image from Author)
Image: Selecting a Column (Image from Author)

Clicking the delta sign in the country column gives us various options, including Filter/Sort, Values, and Summary Stats. For this example, we will use Filter/Sort.

Image: Filter/Sort Pop-up Box (Image from Author)
Image: Filter/Sort Pop-up Box (Image from Author)

By filtering by "Denmark", the Mitosheet gives us all of the animation studios in Denmark. Additionally, the following code for this whole example was produced!

Image: Code Generated by Mito (Image from Author)
Image: Code Generated by Mito (Image from Author)

And just like that, we can quickly create a baseline for our analysis!

Conclusion

Today was just a quick summary of a new Python package I was recently introduced to, Mito. The main benefit of using Mito is it will provide Python code for you and all the user has to do is make changes to a datasheet! This will lead to a much faster analysis for a data scientist as well as decrease the amount of time a user would need for finding out the code for a specific action they wish to take on a dataset. If you ever get stuck on how to code a specfici instance, Mito can be a guide and savior for helping you finish your next project! This was Part 1 of a series of posts I plan to do on Mito to show the full capabilities the library offers. Stay tuned for a more hands-on analysis with a Mitosheet in my next post!

If you enjoyed today’s reading, please give me a follow and let me know if there is another topic you would like me to explore! Additionally, add me on LinkedIn, or feel free to reach out! Thanks for reading!


Towards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.

Write for TDS

Related Articles