# Using the Generated Code

Each time you transform your data in the Mito spreadsheet, Mito generates the equivalent pandas code in the Jupyter Cell directly below the Mito spreadsheet. The code is production-ready, commented, pandas code that you can use however you wish.

## Use the altered dataframes in your analysis

Because Mito generates pandas code for each edit you make in the Mito spreadsheet, its easy to use the altered dataframes in the rest of your analysis. Mito doesn't lock you in to completing your entire analysis in Mito -- it encourages you to utilize the rest of the powerful Python data analytics ecosystem.

To use the altered dataframes in the rest of your analysis, run the code that Mito generates by clickingon the cell containing the code and press the play button in the Jupyter toolbar (or use the keyboard shortcut `shift + Enter`)

Once you've ran the generated code, you can use the altered dataframes in your analysis as you normally would, just by using the dataframe names.

If you see this error, its probably because you forgot to run the Mito generated code!

![Undefined Variable Error](/files/Bxd5SZ5SaUV3iIoaySSv)

## Automate an Analysis

Once you've created a Python script, its easy to reuse that script on a new data set, so long as the new data set has a similar structure to original data set you used to create the script.

Having a similar structure means:

* The dataframe names are the same in the original data set and the new data
* Any column that your script uses has the same column header and dtype in the original and new data set.

*Note: there are some other use case specific reasons that a script might not be reusable. For example, if you've hardcoded filters that aren't relevant to the new dataset.*

If your data sets meet those requirements, then you're good to go! All you need to do is change the dataframe import statements, and rerun the script.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.trymito.io/how-to/using-the-generated-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
