DataFushion的python算法插件
Project description
DataFushion_Plugins_Python说明
1.简介
针对Python算法在DataFushion平台使用所给出的插件,主要用于规范化算法的输入输出
2.使用
- Step1:引入datafushon包中的operation模块
- Step2:使用资源管理器进行数据拆解处理,并在其中实现自己需要实现的业务算法逻辑
from datafushion import operation
if __name__ == '__main__':
with operation() as destruction:
input_data_struct_list = destruction['input_data_struct_list']
param_map = destruction['param_map']
param_multiply = float(param_map['multiply'])
data_result = []
for input_data_struct in input_data_struct_list:
file_input_mapping = input_data_struct['file_input_mapping']
data_list = input_data_struct['data_list']
field_x = file_input_mapping['x']
field_y = file_input_mapping['y']
for data in data_list:
sum_result = param_multiply * (float(data[field_x]) + float(data[field_y]))
res = {
"sum": sum_result
}
data_result.append(res)
destruction['data_result'] = data_result
注意:
input_data_struct_list中包含了输入数据的封装,其类型为List
其元素为字典类型,包含的属性为file_type,file_path,file_input_mapping,data_list
算法需要使用的是file_input_mapping和data_list
data_list是输入数据的字典列表
file_input_mapping为输入数据字段的映射
param_map为算法的参数字典
在对数据进行业务算法处理完成后,需要将拆解的destruction中的data_result属性赋值为业务算法的最终数据结果
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for datafushion_plugins_python-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 614dc2b3ad74959a550365e348bdb7b25f90c4c9b8152c27127091ed0e2f6d47 |
|
MD5 | c2cca859b35421585debe2718a17a6ba |
|
BLAKE2b-256 | bf2e97801c8fd9dc2aa14a90902be955c7889e6e356f5c58e3cfaad27e321ccc |
Close
Hashes for datafushion_plugins_python-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7d651943f374d904cd8984df068cfe1a6b2d5b440d8f7fe1212e0087b9eb461 |
|
MD5 | 0edb008b23ee88c4228fd398359578f4 |
|
BLAKE2b-256 | 098ac745fc9a84e743ff66ba44660e085ec0023c697216b656759657a368d8de |