Skip to main content

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.

"Excel screenshot

>>> 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)

"Excel screenshot

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pandas-xlsx-tables-1.0.0.tar.gz (32.4 kB view hashes)

Uploaded Source

Built Distribution

pandas_xlsx_tables-1.0.0-py2.py3-none-any.whl (8.1 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page