如何使用Java在透视表中设置标题。我必须使用apache POI在excel表中创建数据透视表。现在使用Java更改行和列标题标签。
import java.io.FileOutputStream;
import java.io.*;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.*;
import org.apache.poi.xssf.usermodel.*;
public class readxlsx {
public static void main(String[] args) throws Exception{
/* Read the input file that contains the data to pivot */
FileInputStream input_document = new FileInputStream(new File("inputFile.xlsx"));
/* Create a POI XSSFWorkbook Object from the input file */
XSSFWorkbook my_xlsx_workbook = new XSSFWorkbook(input_document);
/* Read Data to be Pivoted - we have only one worksheet */
XSSFSheet sheet = my_xlsx_workbook.getSheetAt(0);
/* Get the reference for Pivot Data */
AreaReference a=new AreaReference("A1:C51");
/* Find out where the Pivot Table needs to be placed */
CellReference b=new CellReference("I5");
/* Create Pivot Table */
XSSFPivotTable pivotTable = sheet.createPivotTable(a,b);
/* Add filters */
pivotTable.addReportFilter(0);
pivotTable.addRowLabel(1);
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, 2);
/* Write Pivot Table to File */
FileOutputStream output_file = new FileOutputStream(new File("POI_XLS_Pivot_Example.xlsx"));
my_xlsx_workbook.write(output_file);
input_document.close();
}
}
这可能有助于您的问题。
我是vba新手,正在尝试使用vba和Excel创建。 我想创建像下面的图像作为输入表。 我试图添加、、、的行标签,值为、和。不为SHEET1生成任何透视表。
Microsoft Excel 的功能真的可以用博大精深来形容。特别是自Excel 2007 在原有的基础上又增加了一些更简单易用的功能。 特别是数据透视表功能,更被认为是Excel 的精华所在。 本文从创建数据透视表到使用数据透视表查看、汇总、分析数据,还包括数据透视表的布局控制,数据透视表的数据源更新与链接等功能都做了详尽的介绍。
我试图在Pandas中创建跨表/透视表:
问题内容: 我正在将具有两列(A和B)的记录列表转换成矩阵表示形式。我一直在熊猫中使用数据透视功能,但结果最终还是很大。大熊猫支持枢轴化为稀疏格式吗?我知道我可以先将其旋转,然后将其转换为某种稀疏表示,但并不像我想要的那么优雅。我的最终目标是将其用作预测模型的输入。 另外,大熊猫之外是否还有某种稀疏的枢轴能力? 编辑:这是一个非稀疏枢轴的示例 这将创建一个矩阵,其中可能包含人和事物的所有可能组合,
我有一个这样的数据帧: 我想知道我们如何使用GROUPBY实现相同的结果? 感谢帮助。 类似的问题: Pandas列值到列?
在Laravel 4中,当使用4.2文档中描述的多对多关系时,我如何让Laravel为我创建透视表? 我是否需要在我的迁移中为所涉及的两个模型添加一些东西?是否需要手动创建数据透视表的迁移?或者Laravel如何知道创建透视表? 到目前为止,我所做的一切就是将