zoukankan      html  css  js  c++  java
  • ALINK(十一):数据导入与导出 (四)Table数据读入 (TableSourceBatchOp)

    Java 类名:com.alibaba.alink.operator.batch.source.TableSourceBatchOp

    Python 类名:TableSourceBatchOp

    功能介绍

    从Table中生成BatchOperator数据

    参数说明

    名称

    中文名称

    描述

    类型

    是否必须?

    默认值

    代码示例

    Python 代码

    from pyalink.alink import *
    import pandas as pd
    useLocalEnv(1)
    df = pd.DataFrame([
        [0, "0 0 0"],
        [1, "1 1 1"],
        [2, "2 2 2"]
    ])
    inOp = BatchOperator.fromDataframe(df, schemaStr='id int, vec string')
    inOp.getOutputTable()
    TableSourceBatchOp(inOp.getOutputTable()).print()

    Java 代码

    import org.apache.flink.types.Row;
    import com.alibaba.alink.operator.batch.BatchOperator;
    import com.alibaba.alink.operator.batch.source.MemSourceBatchOp;
    import com.alibaba.alink.operator.batch.source.TableSourceBatchOp;
    import org.junit.Test;
    import java.util.Arrays;
    import java.util.List;
    public class TableSourceBatchOpTest {
      @Test
      public void testTableSourceBatchOp() throws Exception {
        List <Row> df = Arrays.asList(
          Row.of(0, "0 0 0"),
          Row.of(1, "1 1 1"),
          Row.of(2, "2 2 2")
        );
        BatchOperator <?> inOp = new MemSourceBatchOp(df, "id int, vec string");
        inOp.getOutputTable();
        new TableSourceBatchOp(inOp.getOutputTable()).print();
      }
    }

    运行结果

    id

    vec

    0

    0 0 0

    1

    1 1 1

    2

    2 2 2

  • 相关阅读:
    jQuery动态效果
    10.嗖嗖移动业务大厅
    10.IDEAD 的xml中配置DTD
    浏览器缓存相关的Http头介绍:Expires,Cache-Control,Last-Modified,ETag
    nginx 重启
    fiddler 路由设置
    JavaScript Source Map 详解
    xdebug.var_display_max_data
    PHP输出当前进程所有变量 / 常量 / 模块 / 函数 / 类
    PHP中文件包含的路径问题
  • 原文地址:https://www.cnblogs.com/qiu-hua/p/14887418.html
Copyright © 2011-2022 走看看