Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2025 12:38 PM
Hi @skosaraju,
Thank you for contacting Databricks support!
Because infer_signature() cannot handle a dict of DataFrames directly, you will need to convert this structure into a dictionary of row dicts, or manually build a ModelSignature.
Option A: Flatten Each DataFrame to Dict
# Create a dictionary of dicts (each containing a single record for each model)
input_example_simplified = {
k: v.iloc[0].to_dict()
for k, v in input_example.items()
}
Now input_example_simplified looks like:
{
"local_outlier_factor": {'x': 1.23, 'y': 4.56},
"isolation_forest": {'a': 0.1, 'b': 0.2, 'c': 0.3}
}
You can use this with
infer_signature():from mlflow.models.signature import infer_signature
signature = infer_signature(input_example_simplified, output_example_simplified)