New in Python: Format your DataFrame like Excel

Jake from Mito
trymito
Published in
3 min readMay 1, 2022
From Author

There is a new Python package called Mito, which allows you to edit a DataFrame, as if it were a spreadsheet. Mito a Python extension that you can call into your Jupyter environment. Each edit you make in Mito will generate the equivalent Python in the code cell below. Mito looks and feels like a spreadsheet — allowing the user to perform Python data science tasks without needing to write perfect code (or any code at all!)

Here is Mito in action:

Here are the commands to install Mito:

python -m pip install mitoinstaller
python -m mitoinstaller install

Then open Jupyter Lab and call the Mitosheet

import mitosheet
mitosheet.sheet()

The full instructions can be found on the Mito website under “docs.”

One of the great things about spreadsheets is that you can edit your data very quickly. In Mito, you can pick any data-point in the DataFrame and change the value by typing it in — just like a spreadsheet.

Before you start editing your values, you’ll want to import your data. Mito allows you to pass in any DataFrame, but you can also pass in any Excel or CSV file, directly from your local file system, which you can navigate from Mito. The tool can handle data sizes that a spreadsheet will not allow and process the data much faster than any spreadsheet.

After you perform your analysis, you can also export for your data as an Excel or CSV file by clicking the “export” button in the tool bar.

As mentioned above, each edit you make in Mito will generate the equivalent Python in the code cell below in your notebook. This is an incredibly fast way to generate Python scripts and perform data analysis and cleaning.

Mito has operations such as:

  • Pivot Tables
  • Graphing
  • Merging
  • Filtering
  • Sorting
  • Summary Statistics
  • Spreadsheet Formulas
  • Deduplicating
  • and more!

Here is what Pivot tables and Graphing look like in Mito (each of these generates production ready Python for you):

from Author
from Author

One powerful feature of Mito from the list above is the ability to use spreadsheet formulas inside a Python environment. These formulas are simple to use and require much less tedious syntax than Pandas, yet they still generate the equivalent Pandas code in the cell below.

New Mito Features:

Mito recently introduced formatting features where, you can format your cells like you are using Excel.

You can also export your DataFrame to Excel or a CSV file, using the export interface:

--

--

Jake from Mito
trymito

Exploring the future of Python and Spreadsheets