Library of export pandas into excel for CICCers
Project description
Install
pip install cicc_excel
How to Use
from cicc_excel.excelwriter import ExcelWriter
# create new writer
# default font is 宋体, Arial, Times New Roman
# to setup a percentage column, put a % in column name
# default col width will adjust by font_size
wb = ExcelWriter('export_file_name.xlsx', ch_font="中文字体", num_font="Number Font", en_font="English Font", first_row_color='#EEECE1', first_row_height=20, font_size=10)
#load data into writer in pandas dataframe
wb.load_data(df)
#set highlight columns by name
#color in #FFFFFF format
wb.set_hl_col_by_names('col_name', 'sheet_name', 'background_color', 'color')
wb.set_hl_col_by_names('col_name2', 'sheet_name', 'background_color2', 'color2')
#write dataframe to xlsx file
wb.write_data('sheet_name')
#hide cols
wb.hide_col(5,12,'sheet_name')
#collapse cols (have a + on top)
wb.collapse_col(5,12,'sheet_name')
#freeze cell
wb.freeze(1,4, 'sheet_name')
#set hightlight columns for another sheet
#default background color is yellow
wb.load_data(df2)
wb.set_hl_col_by_names('col_name', 'another_sheet_name')
wb.write_data('another_sheet_name')
#another sheet
wb.load_data(df3)
wb.write_data('last_sheet_name')
#save file
wb.save()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cicc_excel-0.4.1.tar.gz
(4.8 kB
view details)
Built Distribution
File details
Details for the file cicc_excel-0.4.1.tar.gz
.
File metadata
- Download URL: cicc_excel-0.4.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 287024ab7ef8eaa931508c19baa4246b8026b2a27cc0c1922eff4b37cb97864e |
|
MD5 | 32d242ba5736cd1df820f9c8109fab52 |
|
BLAKE2b-256 | 0441f9ba44f047f6f617b45246d87b206ff3a3b2f53ced9b48faa68f766d2162 |
File details
Details for the file cicc_excel-0.4.1-py3-none-any.whl
.
File metadata
- Download URL: cicc_excel-0.4.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d5facd4f71317cad58c525a48af57db1b27bd19c3aa9af8a29ac6305656d8b5 |
|
MD5 | 8a43ff3e8e7012655b1365bab884519c |
|
BLAKE2b-256 | 2b13e4bd7350d85adf3a23654944f76c2914281e37938f69683feb688e2fcb51 |