zoukankan      html  css  js  c++  java
  • java数据处理框架-Joinery 使用(类似于python中的pandas)

    cankao :https://blog.csdn.net/weixin_44112790/article/details/95387314

    git doc:

    然后是DataFrame的手册,可以在里面查找更多的方法,其实都和pandas的差不多。
    http://cardillo.github.io/joinery/v1.9/api/reference/joinery/DataFrame.html
    接着是GitHub地址,有兴趣的可以研究研究源码
    https://github.com/cardillo/joinery

    依赖:

    <dependency>
          <groupId>joinery</groupId>
          <artifactId>joinery-dataframe</artifactId>
          <version>1.9</version>
        </dependency>

    如果需要处理csv的话,还得添加一个依赖:

    <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.17</version>
    </dependency>

    简单使用:

    @Test
            public  void testDataFrame() 
            {
             //创建
             DataFrame<Object> df = new DataFrame<>("name", "value");
             //添加数据
             df.append(Arrays.asList("xiaoming", 1));
             df.append(Arrays.asList("lily", 2));
             df.append(Arrays.asList("tom", 3));
             df.append(Arrays.asList("sea", 3));
             
             List<Object> col = df.col("name");
             System.err.println(col);
             System.err.println("******");
             //行数
             System.out.println(df.length());
             //空表判断
             System.out.println(df.isEmpty());
             //多列合并成一列进行输出
             System.out.println(df.flatten());
             //计算常用统计量
             System.out.println(df.mean().col("value"));
             System.out.println(df.median().col("value"));
             System.out.println(df.max().col("value"));
             System.out.println(df.min().col("value"));
             System.out.println(df.var().col("value"));
             // 以下演示如何获取每一格的数据
             Set<Object> indexs = df.index();
             Set<Object> columns = df.columns();
             for(Object index:indexs)
             {
                for(Object column:columns)
                {
                    System.out.print(df.get(index, column));
                    System.out.print("	");
                }
                System.out.println();
             }
             //保存为csv文件
             try {
    //            df.writeCsv("./test.csv");
                df.writeXls("./test.xls");
    //            df.readXls(file)
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    还有一款:(暂时没有研究)!!!!!!!   还有这个:https://jtablesaw.github.io/tablesaw/userguide/tables

    <!-- https://mvnrepository.com/artifact/com.github.chen0040/java-data-frame -->
    <dependency>
        <groupId>com.github.chen0040</groupId>
        <artifactId>java-data-frame</artifactId>
        <version>1.0.11</version>
    </dependency>
  • 相关阅读:
    【微信小程序】自定义模态框实例
    编程微刊第四期文章汇总(2018.4)
    ajax实现简单的点击左侧菜单,右侧加载不同网页
    JS数组排序技巧汇总(冒泡、sort、快速、希尔等排序)
    bootstrap+fileinput插件实现可预览上传照片功能
    css实现悬浮效果的阴影
    推荐一款优雅高效的免费在线APP原型工具
    前端工程师提高工作效率的几个小技巧
    程序员常用的六大技术博客类
    程序媛,坚持这几个好习惯让你越来越美
  • 原文地址:https://www.cnblogs.com/lshan/p/12856016.html
Copyright © 2011-2022 走看看