onnxruntime/onnxruntime/python/tools/featurizer_ops
Gani Nazirov c42867c016
Update data_frame_tool to latest (#3919)
* update data_frame_tool to latest:
Handle datetime and catecorical dataframe column types.
Handle ML.NET / Featurizers metadata outputs.
Input and Output are pandas dataframes.

* remove whitespaces

* reformat comment
remove whitespaces

* reformat comment
remove whitespaces

Co-authored-by: Gani Nazirov <ganaziro@microsoft.com>
2020-05-18 21:13:56 -07:00
..
create_test_model.py Use yapf to format python (#3276) 2020-03-20 14:34:10 -07:00
data_frame_tool.py Update data_frame_tool to latest (#3919) 2020-05-18 21:13:56 -07:00
data_frame_tool_test.py Use yapf to format python (#3276) 2020-03-20 14:34:10 -07:00
README.md Package data_frame_tool, include featurizers into Manilinux2010 (#2989) 2020-02-07 11:38:42 -08:00

DataFrameTool overview

This tool helps to feed data from an an instance of pandas DataFrame to a loaded ONNX model using ONNX Runtime API.

Example of usage

See example of usage in feed_inputs_test.py in the same directory.

import onnxruntime as onnxrt
import numpy as np
import pandas as pd

from feed_inputs import DataFrameTool

# Load the onnx model
sess_options = onnxrt.SessionOptions()
sess_options.enable_profiling = args.profile

df_tool = DataFrameTool(args.model_path, sess_options)

# Create a DataFrame that holds 3 inputs, string, bool, float in their respective columns
df = pd.DataFrame([['string_input', 3.25, 8, 16, 32, 64, True, 0.25]], 
                  columns=['StringInput', 'DoubleInput', 'Int8Input', 'Int16Input', 'Int32Input', 'Int64Input', 'BoolInput', 'Float32Input'])

outputs = df_tool.execute(df, [])
print('Outputs: ', outputs)