Skip to main content

format data to reStructedText and Markup Table

Project description

format data to Table

Output table

  • reStructuredText

  • Markdown

  • html

  • csv

  • pandas.dataframe

Read table from

  • html

  • csv

  • rst

  • md

Example

data = [
    [h, h, h...], # header = 1
    [d, d, d...],
    [d, d, d...],
    ...
]

table = MarkupTable(data, header=1)
print(table.to_rst())
print(table.to_md())
print(table.to_csv('csv_file'))

table.append_row(['a', 'b', 'c', 'd', 'e'])
table.set_align('center', rows=[0])
table.set_align('left',rows=range(1, table.row_count(), columns=[3])
table.set_align('right',rows=range(1, table.row_count(), columns=[4])

table.set_format(lambda x: '{:,.2f} %'.format(x), rows=range(1, table.row_count()), columns=[4])

table = MarkupTable.from_html(open('html_file').read())
print(table.to_rst())

table = MarkupTable.from_csv(open('csv_file').read())
print(table.to_rst())

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mtable-0.2.22-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file mtable-0.2.22-py3-none-any.whl.

File metadata

  • Download URL: mtable-0.2.22-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.5

File hashes

Hashes for mtable-0.2.22-py3-none-any.whl
Algorithm Hash digest
SHA256 1488f81a2eca70a952370d796303a48921b904fedb65e12236d91ff26fd16c95
MD5 e33307af0591581eab585b9eb6fae443
BLAKE2b-256 6c56ae07b3398cabb6fb387f7f3578ae84c693cc13674c591dcc1d7596d6b34a

See more details on using hashes here.

Supported by

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