> For the complete documentation index, see [llms.txt](https://docs.trymito.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.trymito.io/how-to-1/pass-a-dataframe-into-mito.md).

# Pass a dataframe into Mito

Query a database, or scrape a table from a website and import the dataframe into Mito. Import any Pandas dataframe into Mito.

#### Import Python Packages

To import a dataframe into Mito, we need the Mito and pandas packages. Both are distributed through the Mito installer. If you have not yet installed Mito, follow the instructions [here](/getting-started/installing-mito.md).&#x20;

```python
# Import Python packages
import mitosheet 
import pandas as pd
```

#### Create the Pandas Dataframes&#x20;

Using Pandas, you can create dataframes by [reading csv files](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html), [Excel files](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html), or even [querying an SQL database](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_sql_query.html).&#x20;

For the purposes of this tutorial, we will create two sample dataframes.&#x20;

```python
# Create some simple data to display 
train_stations = pd.DataFrame({'Zip': [21001, 97321, 49224, 87102, 24910, 22301], 'City': ['Aberdeen', 'Albany', 'Albion', 'Albuquerque', 'Alderson', 'Alexandria'], 'State': ['MD', 'OR', 'MI', 'NM', 'WV', 'VA'], 'Ticket_Office': ['N', 'Y', 'N', 'Y', 'N', 'Y']}) 
demographics = pd.DataFrame({'Zip': [21001, 97321, 49224, 87102, 24910, 22301], 'Median_Income': [53979.0, 112924.0, 37556.0, 28388.0, 30914.0, 54087.0], 'Mean_Income': [66169.0, 147076.0, 50371.0, 39529.0, 40028.0, 64068.0], 'Pop': [18974.0, 11162.0, 14900.0, 22204.0, 5383.0, 19504.0]})
```

#### Pass the dataframes into Mito

To import the dataframe into Mito, just provide it as an argument to the mitosheet.sheet() function call.&#x20;

```python
# Render the Mitosheet with the data
mitosheet.sheet(train_stations, demographics)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.trymito.io/how-to-1/pass-a-dataframe-into-mito.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
