Skip to main content

SpreadPandas: data frame to spreadsheet mapping

Python 3.7+ Code style: black GitHub license PyPI version fury.io PyPi

What is it?

SpreadPandas is a Python package to get the projected dimensions of a pandas data frame if it were to be transposed to a spreadsheet.

By creating a SpreadsheetMap object, understand which cells of a spreadsheet the data frame would occupy, with detail for its header, index and body.

The goal is for this package to serve as a basis to perform more complex operations, like Excel customization or Google Sheet exporting, that require to establish a precise mapping between the data frame content and the target cells.

Quick Start

Installation

You can install EasyPred via pip

pip install spreadpandas

Alternatively, you can install EasyPred by cloning the project to your local directory

git clone https://github.com/FilippoPisello/SpreadPandas

And then run setup.py

python setup.py install

Usage

Take an example pandas data frame:

>>> import pandas as pd
>>> df = pd.DataFrame({"COL1" : [1, 2, 3], "COL2" : [4, 5, 6]})
>>> df
   COL1  COL2
0     1     4
1     2     5
2     3     6

Use SpreadMap to get its spreadsheet mapping. Suppose the index should not be brought over to the spreadsheet:

>>> from spreadpandas import SpreadMap
>>> spreadmap = SpreadMap(df, keep_index=False)
>>> spreadmap.header.cells
('A1', 'B1')
>>> spreadmap.body.cells
('A2', 'B2', 'A3', 'B3', 'A4', 'B4')
>>> spreadmap.index
None

If the index should be kept instead:

>>> spreadmap = SpreadMap(df, keep_index=True)
>>> spreadmap.header.cells
('B1', 'C1')
>>> spreadmap.body.cells
('B2', 'C2', 'B3', 'C3', 'B4', 'C4')
>>> spreadmap.index.cells
('A2', 'A3', 'A4')

The content can also be moved by skipping rows and/or columns:

>>> spreadmap = SpreadMap(df, keep_index=True, skip_rows=2, skip_columns=1)
>>> spreadmap.header.cells
('C3', 'D3')
>>> spreadmap.body.cells
('C4', 'D4', 'C5', 'D5', 'C6', 'D6')
>>> spreadmap.index.cells
('B4', 'B5', 'B6')

Dependencies

EasyPred depends only on pandas.

Documentation

For the moment, this is the only documentation available.

License

MIT

Metadata

Release files for spreadpandas 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spreadpandas 0.0.2
File Size Uploaded
spreadpandas-0.0.2.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spreadpandas 0.0.2
File Interpreter ABI Platform
spreadpandas-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 15.9 kB

Release files / spreadpandas-0.0.2.tar.gz

Download URL spreadpandas-0.0.2.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2b78d049f11e46e4951562601231d63a05a0b1f8ecf0b71ebefcc4ae0d2707ea
BLAKE2b-256 checksum
How to use checksums
7d72652ad7199f706c0141d0a7cafd5fc4244154553569422b8c96a552f3890b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.1

Release files / spreadpandas-0.0.2-py3-none-any.whl

Download URL spreadpandas-0.0.2-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae67ef262720ba9aa8f6375eaf0c7cb6b7e1ff9fbb1759ea35f2c87d18948b8b
BLAKE2b-256 checksum
How to use checksums
2fdc63f07a02e9352cc08fd57d9a832879165064ffb24bcc5447c10734b45e2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.1

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page