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("\t"); } 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>