Java dataframe 和 数据可视化库 Tablesaw
所属分类 tablesaw
浏览量 159
https://github.com/HelloGitHub-Team/Article/blob/master/contents/Java/tablesaw/content.md
https://github.com/jtablesaw/tablesaw
Java dataframe and visualization library
Tablesaw is a dataframe and visualization library that supports loading, cleaning, transforming, filtering, and summarizing data.
Tablesaw also supports descriptive statistics and can be used to prepare data
for working with machine learning libraries like Smile, Tribuo, H20.ai, DL4J.
Data processing & transformation
Import data from RDBMS, Excel, CSV, TSV, JSON, HTML, or Fixed Width text files, whether they are local or remote (http, S3, etc.)
Export data to CSV, JSON, HTML or Fixed Width files.
Combine tables by appending or joining
Add and remove columns or rows
Sort, Group, Filter, Edit, Transpose, etc.
Map/Reduce operations
Handle missing values
Visualization
Tablesaw supports data visualization by providing a wrapper for the Plot.ly JavaScript plotting library.
Statistics
Descriptive stats:
mean, min, max, median, sum, product, standard deviation, variance, percentiles, geometric mean, skewness, kurtosis, etc.
https://jtablesaw.github.io/tablesaw/userguide/toc
https://jtablesaw.github.io/tablesaw/gettingstarted
https://jtablesaw.github.io/tablesaw/userguide/TimeSeries
项目目录说明
aggregate:maven 的项目父级项目,主要定义项目打包的配置
beakerx:tablesaw 库的注册中心,主要注册表和列
core:tablesaw 库的核心代码,主要是数据的加工处理操作:数据的追加,排序,分组,查询等
data:项目测试数据目录
docs:项目 MarkDown 文档目录
docs-src:项目文档源码目录,主要作用是生成 MarkDown 文档
excel:解析 excel 文件数据的子项
html:解析 html 文件数据的子项目。
json:解析 json 文件数据的子项目
jsplot:数据可视化子项目,主要作用加载数据生成可视化图表
saw:tablesaw 读写图表数据的子项目
tablesaw 0.43.1
@Test
public void tableSawTest6() {
String[] students = {"小明", "李雷", "小二"};
double[] scores = {90.1, 84.3, 99.7};
Table table = Table.create("学生分数统计表").addColumns(
StringColumn.create("姓名", students),
DoubleColumn.create("分数", scores));
System.out.println(table.print());
}
Table robberies = Table.read().csv("./data/boston-robberies.csv");
Plot.show(
AreaPlot.create(
"Boston Robberies by month: Jan 1966-Oct 1975",
robberies, "Record", "Robberies"));
IntColumn intColumn = IntColumn.create ("IntColumn", 10, 20,15);
StringColumn stringColumn = StringColumn.create ("StringColumn", "A", "B","C");
System.out.println(intColumn.print());
System.out.println(stringColumn.print());
Table table = Table.create("table001").addColumns(intColumn,stringColumn);
System.out.println(table.print());
System.out.println(table.summary().print());
Figure figure = PiePlot.create("plot001",table,"StringColumn","IntColumn");
Plot.show (figure);
Tablesaw 绘制图表的过程:
加载数据(Table.read ),然后创建图表(AreaPlot.create ),最后显示图表(Plot.show ),
Plot.show 方法会在本地生成图表的HTML页面,并自动打开浏览器显示,
在不打开浏览器的情况下绘制图表,需要修改Plot.show 方法的调用方式
Plot 类方法 注释掉 new Browser().browse(outputFile);
Table robberies = Table.read().csv("./data/boston-robberies.csv");
File outputFile = new File("/Users/dugang/tmp/tablesawdemo2.html");
// Plotx 复制 Plot代码 ,注释掉 new Browser().browse(outputFile);
Plotx.show(
AreaPlot.create(
"Boston Robberies by month: Jan 1966-Oct 1975",
robberies, "Record", "Robberies"),outputFile);
System.out.println("Plotx.show done,outputFile="+outputFile);
https://gitee.com/dyyx/work2024/tree/master/demo/tiger_quant/tquant-backtester/src/test/java/demo/tablesaw
tablesawdemo2.html
使用 js 画图
https://cdn.plot.ly/plotly-latest.min.js
var data = [ trace0];
Plotly.newPlot(target_target, data, layout);
上一篇
下一篇
grafana告警规则和图表关联
均线拐点
vue3 todolist 例子项目
vue3创建项目并运行
vue3 todolist项目 运行
智能搜索工具