Xlsx filetype utility functions
autofit_columns: Autofit all columns from dataframe written to xlsxfile with xlsxwriter
def autofit_columns(dataframe, worksheet, padding=1.1, index=True):
"""
:param dataframe: Base dataframe written to xlsx workbook
:param worksheet: Sheet in xlsx workbook to be formatted
:param padding: Optional, padding amount
:param index: Optional, Index true/false in dataframe. Defaults true, use false for non-indexed dataframe outputs.
:return: formatted worksheet
"""
Example Call
import pandas as pd
import numpy as np
from xlsxutility import autofit_columns
df = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
columns=['a', 'b', 'c'])
writer = pd.excelwriter("some_path",engine='xlsxwriter')
df.to_excel(writer)
autofit_columns(df,writer.sheets['Sheet1'],index=False)
align_cells: Horizontally or vertically align all cells in given dataframe.
Note - If using in conjunction with autofit_columns this must be called first, or the default width (1) will overwrite.
def align_cells(dataframe,workbook,worksheet, align='center'):
"""
:param dataframe: Reference Dataset, Pandas Dataframe
:type dataframe: Pandas Dataframe
:param workbook: Xlsxwriter workbook
:param worksheet: Xlsxwriter worksheet (must be within workbook)
:param align (optional):Defaults to horizontal center. Alignment types Horizontal: (left / center/ right / fill / justify / center_across / distributed) or Vertical: (top, vcenter, bottom, vjustify, vdistributed)
"""
Example Call
import pandas as pd
import numpy as np
from xlsxutility import align_cells
df = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
columns=['a', 'b', 'c'])
writer = pd.excelwriter("some_path",sheet_name='Example',engine='xlsxwriter')
df.to_excel(writer)
align_cells(df,writer,writer.sheets['Example'],'center')
Metadata
Release files for xlsxutility 1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xlsxutility-1.1.tar.gz | 2.9 kB | Without provenance | Details for xlsxutility-1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xlsxutility-1.1-py3-none-any.whl | Python 3 | none | any | Details for xlsxutility-1.1-py3-none-any.whl |
Total release size: 7.4 kB
Release files / xlsxutility-1.1.tar.gz
| Download URL | xlsxutility-1.1.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f918805ceb1327d29aba4aa963c52f8ac9489635d7eb21407d0dbb729f1e6c0
|
|
BLAKE2b-256 checksum How to use checksums |
f8f21db9ad569a53658d727466464f61ed3d351aaeb1ec1594818949ddbdf80b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Release files / xlsxutility-1.1-py3-none-any.whl
| Download URL | xlsxutility-1.1-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa8fb5544107d97546a472883e663ffd2204c995306dadd3f55d92f00d7a0f2c
|
|
BLAKE2b-256 checksum How to use checksums |
f136c3b68a8890d26c06fa9fb9f38294c883e10accd7a727881509eac2db9499
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Security for xlsxutility 1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.