如何使用XlsxWriter冻结顶行和第一列?

时间:2021-04-09 08:23:48

I am exporting a pandas DataFrame to Excel, and since it contains a lot of rows and columns, it would be useful to keep the top row and the first column when browsing its contents.

我正在将pandas DataFrame导出到Excel,并且由于它包含许多行和列,因此在浏览其内容时保留顶行和第一列会很有用。

There is a feature present in Excel that allows for freezing the top row and the first column. Is accessible through XlsxWriter when exporting DataFrames to excel?

Excel中存在一个允许冻结顶行和第一列的功能。将DataFrames导出到excel时可以通过XlsxWriter访问吗?

1 个解决方案

#1


3  

You can use worksheet.freeze_panes() to achieve this . There are many options for that method. Read http://xlsxwriter.readthedocs.io/worksheet.html#worksheet-freeze-panes to know how to use the method.

您可以使用worksheet.freeze_panes()来实现此目的。该方法有很多选择。阅读http://xlsxwriter.readthedocs.io/worksheet.html#worksheet-freeze-panes以了解如何使用该方法。

#1


3  

You can use worksheet.freeze_panes() to achieve this . There are many options for that method. Read http://xlsxwriter.readthedocs.io/worksheet.html#worksheet-freeze-panes to know how to use the method.

您可以使用worksheet.freeze_panes()来实现此目的。该方法有很多选择。阅读http://xlsxwriter.readthedocs.io/worksheet.html#worksheet-freeze-panes以了解如何使用该方法。