热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

java相似数据处理_java数据处理框架Joinery使用(类似于python中的pandas)

cankao:https:blog.csdn.netweixin_44112790articledetails95387314gitdoc:然后是DataFrame的手册ÿ

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

依赖:

joinery

joinery-dataframe

1.9

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

org.apache.poi

poi

3.17

简单使用:

@Test

public void testDataFrame()

{

//创建

DataFrame df &#61; 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 col &#61; 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 indexs &#61; df.index();

Set columns &#61; df.columns();

for(Object index:indexs)

{

for(Object column:columns)

{

System.out.print(df.get(index, column));

System.out.print("\t");

}

System.out.println();

}

//保存为csv文件

try {

// df.writeCsv("./test.csv");

df.writeXls("./test.xls");

// df.readXls(file)

} catch (IOException e) {

e.printStackTrace();

}

}



推荐阅读
author-avatar
Effy
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有