Guide To MitoSheets: Harnessing Power Of Spreadsheets In Python

The simple concept of MitoSheets is to equip you with spreadsheet functionality in python. It may sound a bit different, but it has a lot of stuff which comes in handy if you are used to Excel but still want to work on python.

Python won’t be the optimum solution for every task. There are many things that can be done quickly in Excel rather than python. One solution would be to alternatively switch between the two and save your work and then get back on the other tool, but this is time-consuming too. Having said that, folks at MitoSheets gave deep thought to it and took the onus to solve this problem. 

They have designed an amazing library which will let you work with spreadsheets without having to switch between two things. Just pass your dataset through one line of code and you’ll have all the functionality you could ever want. Being in its initial phase, as of now we can only perform pivoting, merging and some excel formulas. For the best experience, I and MitoSheets recommend using Jupyter Notebook.

AIM Daily XO

Join our editors every weekday evening as they steer you through the most significant news of the day, introduce you to fresh perspectives, and provide unexpected moments of joy
Your newsletter subscriptions are subject to AIM Privacy Policy and Terms and Conditions.

Firstly, let’s install the library using the command “pip install mitosheet”.

Now let’s understand how to work with the library and make life easy. 

Download our Mobile App

Start by loading the required libraries and importing your datasets. In my case, the name of the CSV files is user_accounts.csv and website_visits.csv. Now we are all set to begin working on spreadsheets in python. 

The above line of code will inject your dataset into a spreadsheet and will show up as two different sheets. The output would look like the below image. 

In this article we’ll perform 3 activities:

  1. Let’s look at some basic excel function. Click on add new column and then select any cell in that column. Here we’ll try to convert the User_ID to upper case using the =UPPER function. After adding the column, double click on the column name of the recently added column and change it to UpperCaseUserID. Now double click any cell in the column and write the following command. 

=UPPER(User_ID). It should look something like this.

Having done that, hit enter and you’ll have a column with all the User_ID entries in an upper-case format. 

The magic doesn’t end here if you are using Jupyter Notebook a new cell will be automatically created for you where you can see the python code for the executed operations. This not only saves time but also help you to show someone the equivalent operation in python code. The cell will look something like this.

  1. Merging the two datasets

Like joins, here we will merge the two imported datasets. To merge we need to have one common key, so just as we did in the previous example, create one more mitosheet in the next cell, add a column to df1, rename it to Cleaned_User_ID and then click on any cell in the column and execute the command =LOWER(User_ID). This will fill the new column with user_id in lower-case. This step is essential to perform the join between the two tables. Now that we have the new column let’s join the two datasets.

From the MitoSheets toolbar click on the Venn diagram icon. This should open a dialogue box as below.

After this, change the merge key for df1 to Cleaned_User_ID to ensure seamless merging of the datasets. 

Now click on merge and you’ll have your new merged dataset with the python code generated by MitoSheets as below. 

After doing the operations, you can also save the analysis for future use by clicking on the save icon present on the MitoSheets toolbar. Saving the analysis doesn’t mean that it’s downloaded on your local machine; for that, you’ll have to click on the download button. 

  1. Pivots

Now in the merged dataset, add a new column and name it Weekend_Visits. After that click on any cell in the column and then write =(Total_Visits – Weekday_Visits). Now let’s move to our pivot table. Click on the group like looking icon on the MitoSheets toolbar. This should open a window from which you should select the rows to be Account_Type, columns can be left as it is, values will be Weekend_Visits and select sum. It should look like the following. 

Performing this action will generate the below pivot table. 

Note: MitoSheets is still not available for public use but you can ask them for a trial, and they’ll be happy to help. 


Currently, it’s in development stages but I believe soon it will become a very handy tool and will be able to provide us with more functionality.

Sign up for The Deep Learning Podcast

by Vijayalakshmi Anandan

The Deep Learning Curve is a technology-based podcast hosted by Vijayalakshmi Anandan - Video Presenter and Podcaster at Analytics India Magazine. This podcast is the narrator's journey of curiosity and discovery in the world of technology.

Rithwik Chhugani
I am a final year Data Science student with good experience in working with startups across India and Australia in the Machine Learning and AI space. I am always in search of tasks that challenge me to broaden my vision and enhance the level of experience. Looking for a full-time position after my graduation in April 2021. Hit me up if you have an opportunity for me.

Our Upcoming Events

24th Mar, 2023 | Webinar
Women-in-Tech: Are you ready for the Techade

27-28th Apr, 2023 I Bangalore
Data Engineering Summit (DES) 2023

23 Jun, 2023 | Bangalore
MachineCon India 2023 [AI100 Awards]

21 Jul, 2023 | New York
MachineCon USA 2023 [AI100 Awards]

3 Ways to Join our Community

Telegram group

Discover special offers, top stories, upcoming events, and more.

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Subscribe to our Daily newsletter

Get our daily awesome stories & videos in your inbox

Is Foxconn Conning India?

Most recently, Foxconn found itself embroiled in controversy when both Telangana and Karnataka governments simultaneously claimed Foxconn to have signed up for big investments in their respective states