Skip to main content

Merge cells while tabulating tables.

Project description

Tabulate Cell Merger

This is a package to merge cells when tabulating table. A table is a list of lists which can be represented into rows and columns. It is inspired in the already existing tabulate package.

How to import the module

Module's name for importing:

import tabulate_cell_merger.tabulate_cell_merger

How to use

The module contains one function for you to use: tabulate() This function accepts three arguments as following: tabulate(table, colspan, rowspan) The colspan and rowspan are optional arguments. The table argument is required.

To merge cells horizontally, use the colspan argument. To merge cells vertically, use the rowspan argument. These arguments are dictionaries. They allow you to stretch cells over others. Syntax:

colspan = {(y, x): value}
rowspan = {(y, x): value}

For each cell you want to stretch, you have to associate its coordinates, having then a tuple as key, to a stretching value: 1 generates no stretching, 2 stretches over one other cell (to the right or to downwards), etc.") Here, y is the cell row, x the cell column, and value the stretching value.

An example

Input:

table = [['a1', 'b1'], ['a2', 'b2']]
colspan = {(0, 0): 2}
rowspan = {(0, 1): 2}

Output:

+----+----+
| a1      |
+----+    +
| a2 |    |
+----+----+

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

tabulate-cell-merger-0.0.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

tabulate_cell_merger-0.0.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file tabulate-cell-merger-0.0.1.tar.gz.

File metadata

  • Download URL: tabulate-cell-merger-0.0.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0

File hashes

Hashes for tabulate-cell-merger-0.0.1.tar.gz
Algorithm Hash digest
SHA256 62120e1cef429e1ca075029e92f56d22fa54fb5215d712199161923ac3863146
MD5 f0f81bc6ede2e94ebe2c34c6c5bc6e5d
BLAKE2b-256 c08125bce8cce529be2a5f2a94a85dd823c9528922d7e591f3525d0d77102a68

See more details on using hashes here.

File details

Details for the file tabulate_cell_merger-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tabulate_cell_merger-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0

File hashes

Hashes for tabulate_cell_merger-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7d92e27b38d8c20833d8b6662d7b71f29dfd6e7c8fba442ad93e851972ab348b
MD5 12cad1f536f7dfde6ac849d1958ac197
BLAKE2b-256 ca802a61913a11f025a12a2c0837aac39ec101ffc1da997bfe7a508e5e324ad3

See more details on using hashes here.

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