Read and write excel tables with pandas
Project description
pandas-xlsx-tables
Even though you might not like it, Excel isn't going anywhere. And Excel with tables is a lot better than without. Some highlights are: better performance, reference columns by name (vs defining named ranges), sticky headers (vs freeze panes), stricter typing (vs random types) and sort/filter dropdowns.
Out of the box Pandas provides to and from excel functionality, but it cannot write native excel tables (the result is only formatted like one). This is where pandas-xlsx-tables comes in: convert excel tables to dataframes and vice versa, whilest mostly preserving data types. The api has been kept deliberatly simple as to provide useful functionality out of the box.
>>> from pandas_xlsx_tables import xlsx_table_to_df
>>> df = xlsx_table_to_df("my_file.xlsx", "Table1")
>>> df
col1 col2
Row
0 1 a
1 2 b
And the reverse process:
>>> from pandas_xlsx_tables import df_to_xlsx_table
>>> df_to_xlsx_table(df, "my_table", header_orientation="diagonal", index=False)
Why not integretate this in Pandas directly?
Due to the complexity of Pandas and the large number of users it is very difficult to significantly change the current excel implementeation. Also the abstractions available to plug different engines are not that helpful. Basically I tried and gave up (but of course I would prefer having this built into Pandas).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pandas-xlsx-tables-1.0.0.tar.gz
.
File metadata
- Download URL: pandas-xlsx-tables-1.0.0.tar.gz
- Upload date:
- Size: 32.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4df099625b5bdac11795fafca740035bb24a3e02b10f5f7c85971d0e522e8f9 |
|
MD5 | 872c897bdef787d1d6231cf558a9b8fe |
|
BLAKE2b-256 | 243cd3c60a2291fa6499b49fa5c59b9f7f0c60f43810ea544ec2eaa2692f46c9 |
File details
Details for the file pandas_xlsx_tables-1.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pandas_xlsx_tables-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 675ad29c74258610c8c1cfae4582d515a08ad7a95d7091899c79ac28d5e4bd3d |
|
MD5 | 166c2f40fae4fface07987fd02f7840b |
|
BLAKE2b-256 | f726bbe5bf993ef613c4c814219eaea33085e918c6e4f982dc50a9c9ac070ca8 |