Import: Generated UI from any Python Function
Automatically generate UI's to import data from your enterprise's databases.
Last updated
Automatically generate UI's to import data from your enterprise's databases.
Last updated
© Mito
This is a Mito Enterprise feature. Upgrade to extend your spreadsheet with additional spreadsheet functions.
The Mito spreadsheet is built to be extensible to your teams use case. Mito users can augment the data analysis capabilities of their team by incorporating existing Python functions into their sheet.
Namely, any function that returns a dataframe can be exposed to a Mito user within a spreadsheet, automatically. This allows less-technical teammates to benefit from all the Python code written by the programmers in your org, without these less-technical folks needing to learn to code! Also, it requires no additional UI building by you!
See also: bring your own spreadsheet functions.
Imagine we have a function that takes some inputs and returns a dataframe:
You can simply pass this to the mitosheet call in a notebook or Streamlit:
Then, this function will be accessible in the Import dropdown within the mitosheet, where an option for Get Loan Data will appear.
Selecting this option will open a UI this is automatically generated for this function:
Simply use the importers
parameter to the spreadsheet
component in Streamlit. See more in the Streamlit API reference.
For Mito to automatically generate the correct UI for your function, it should have Python types attached to it. The currently supported types:
str
A string input.
int
A number input. The input will be cast with the int
function.
float
A number input. The input will be cast with the float
function.
bool
A toggle. The input will be cast with the bool
function.
pd.DataFrame
A dataframe select, allowing users to select from the dataframes in Mito.
List[int]
A list of number inputs. Each input will be cast with the int function.
Dict[str, str]
A pair of string inputs.
ColumnHeader
A column select, referencing the nearest pd.DataFrame type. See below.
unlabeled
An input that will be evaluated with the Python eval
function.
The ColumnHeader
type can be imported from the Mito extension package, and tells Mito to generate a UI that allows a user to select a specific column from the preceding dataframe in the auto-generated UI.
Notably, any ColumnHeader parameter will error if it is not preceeded by a pd.DataFrame
parameter -- as it is unclear which dataframe the ColumnHeader
is referencing!
Using the List[int] data type to let users filter a dataframe to relevant rows.