pytablewriter is a python library to write a table in various formats: CSV/HTML/JavaScript/JSON/Markdown/Excel/Pandas/Python/reStructuredText
Project description
pytablewriter
=============
.. image:: https://img.shields.io/pypi/pyversions/pytablewriter.svg
:target: https://pypi.python.org/pypi/pytablewriter
.. image:: https://travis-ci.org/thombashi/pytablewriter.svg?branch=master
:target: https://travis-ci.org/thombashi/pytablewriter
.. image:: https://ci.appveyor.com/api/projects/status/2w0611ajvw21vho5?svg=true
:target: https://ci.appveyor.com/project/thombashi/pytablewriter
.. image:: https://coveralls.io/repos/github/thombashi/pytablewriter/badge.svg?branch=master
:target: https://coveralls.io/github/thombashi/pytablewriter?branch=master
Summary
-------
pytablewriter is a python library to write a table in various formats: CSV/HTML/JavaScript/JSON/Markdown/Excel/Pandas/Python/reStructuredText
Features
--------
- Write a table in various formats:
- CSV
- Microsoft Excel :superscript:`TM`
- HTML
- JavaScript (Definition of a nested list variable)
- JSON
- Markdown
- Pandas (Definition of a DataFrame variable)
- Python code (Definition of a nested list variable)
- reStructuredText
- Grid table
- Simple Table
- CSV table
- Automatic value formatting
- Alignment
- Padding
- Decimal places of numbers
- Output to a stream such as a file or the standard output
Examples
========
Write a Markdown table
----------------------------
.. code:: python
import pytablewriter
writer = pytablewriter.MarkdownTableWriter()
writer.table_name = "zone"
writer.header_list = ["zone_id", "country_code", "zone_name"]
writer.value_matrix = [
["1", "AD", "Europe/Andorra"],
["2", "AE", "Asia/Dubai"],
["3", "AF", "Asia/Kabul"],
["4", "AG", "America/Antigua"],
["5", "AI", "America/Anguilla"],
]
writer.write_table()
.. code::
# zone
zone_id|country_code| zone_name
------:|------------|----------------
1|AD |Europe/Andorra
2|AE |Asia/Dubai
3|AF |Asia/Kabul
4|AG |America/Antigua
5|AI |America/Anguilla
Rendering result
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. figure:: ss/markdown.png
:scale: 80%
:alt: markdown_ss
Rendered markdown at GitHub
Write a JavaScript table (variable definition of nested list )
----------------------------------------------------------------
.. code:: python
import pytablewriter
writer = pytablewriter.JavaScriptTableWriter()
writer.table_name = "zone"
writer.header_list = ["zone_id", "country_code", "zone_name"]
writer.value_matrix = [
["1", "AD", "Europe/Andorra"],
["2", "AE", "Asia/Dubai"],
["3", "AF", "Asia/Kabul"],
["4", "AG", "America/Antigua"],
["5", "AI", "America/Anguilla"],
]
writer.write_table()
.. code:: js
var zone = [
["zone_id", "country_code", "zone_name"],
[1, "AD", "Europe/Andorra"],
[2, "AE", "Asia/Dubai"],
[3, "AF", "Asia/Kabul"],
[4, "AG", "America/Antigua"],
[5, "AI", "America/Anguilla"]
];
Write an Excel table
----------------------------
.. code:: python
import pytablewriter
writer = pytablewriter.ExcelTableWriter()
writer.open_workbook("sample_single.xlsx")
writer.make_worksheet("zone")
writer.header_list = ["zone_id", "country_code", "zone_name"]
writer.value_matrix = [
["1", "AD", "Europe/Andorra"],
["2", "AE", "Asia/Dubai"],
["3", "AF", "Asia/Kabul"],
["4", "AG", "America/Antigua"],
["5", "AI", "America/Anguilla"],
]
writer.write_table()
writer.close()
Output
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. figure:: ss/excel_single.png
:scale: 100%
:alt: excel_single
Output excel file (``sample_single.xlsx``)
For more information
--------------------
More examples are available at
http://pytablewriter.readthedocs.org/en/latest/pages/examples/index.html
Installation
============
::
pip install pytablewriter
Dependencies
============
Python 2.7+ or 3.3+
- `DataPropery <https://github.com/thombashi/DataProperty>`__
- `dominate <http://github.com/Knio/dominate/>`__
- `pathvalidate <https://github.com/thombashi/pathvalidate>`__
- `six <https://pypi.python.org/pypi/six/>`__
- `XlsxWriter <http://xlsxwriter.readthedocs.io/>`__
Test dependencies
-----------------
- `pytest <http://pytest.org/latest/>`__
- `pytest-runner <https://pypi.python.org/pypi/pytest-runner>`__
- `SimpleSQLite <https://github.com/thombashi/SimpleSQLite>`__
- `tox <https://testrun.org/tox/latest/>`__
Documentation
=============
http://pytablewriter.readthedocs.org/en/latest/
=============
.. image:: https://img.shields.io/pypi/pyversions/pytablewriter.svg
:target: https://pypi.python.org/pypi/pytablewriter
.. image:: https://travis-ci.org/thombashi/pytablewriter.svg?branch=master
:target: https://travis-ci.org/thombashi/pytablewriter
.. image:: https://ci.appveyor.com/api/projects/status/2w0611ajvw21vho5?svg=true
:target: https://ci.appveyor.com/project/thombashi/pytablewriter
.. image:: https://coveralls.io/repos/github/thombashi/pytablewriter/badge.svg?branch=master
:target: https://coveralls.io/github/thombashi/pytablewriter?branch=master
Summary
-------
pytablewriter is a python library to write a table in various formats: CSV/HTML/JavaScript/JSON/Markdown/Excel/Pandas/Python/reStructuredText
Features
--------
- Write a table in various formats:
- CSV
- Microsoft Excel :superscript:`TM`
- HTML
- JavaScript (Definition of a nested list variable)
- JSON
- Markdown
- Pandas (Definition of a DataFrame variable)
- Python code (Definition of a nested list variable)
- reStructuredText
- Grid table
- Simple Table
- CSV table
- Automatic value formatting
- Alignment
- Padding
- Decimal places of numbers
- Output to a stream such as a file or the standard output
Examples
========
Write a Markdown table
----------------------------
.. code:: python
import pytablewriter
writer = pytablewriter.MarkdownTableWriter()
writer.table_name = "zone"
writer.header_list = ["zone_id", "country_code", "zone_name"]
writer.value_matrix = [
["1", "AD", "Europe/Andorra"],
["2", "AE", "Asia/Dubai"],
["3", "AF", "Asia/Kabul"],
["4", "AG", "America/Antigua"],
["5", "AI", "America/Anguilla"],
]
writer.write_table()
.. code::
# zone
zone_id|country_code| zone_name
------:|------------|----------------
1|AD |Europe/Andorra
2|AE |Asia/Dubai
3|AF |Asia/Kabul
4|AG |America/Antigua
5|AI |America/Anguilla
Rendering result
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. figure:: ss/markdown.png
:scale: 80%
:alt: markdown_ss
Rendered markdown at GitHub
Write a JavaScript table (variable definition of nested list )
----------------------------------------------------------------
.. code:: python
import pytablewriter
writer = pytablewriter.JavaScriptTableWriter()
writer.table_name = "zone"
writer.header_list = ["zone_id", "country_code", "zone_name"]
writer.value_matrix = [
["1", "AD", "Europe/Andorra"],
["2", "AE", "Asia/Dubai"],
["3", "AF", "Asia/Kabul"],
["4", "AG", "America/Antigua"],
["5", "AI", "America/Anguilla"],
]
writer.write_table()
.. code:: js
var zone = [
["zone_id", "country_code", "zone_name"],
[1, "AD", "Europe/Andorra"],
[2, "AE", "Asia/Dubai"],
[3, "AF", "Asia/Kabul"],
[4, "AG", "America/Antigua"],
[5, "AI", "America/Anguilla"]
];
Write an Excel table
----------------------------
.. code:: python
import pytablewriter
writer = pytablewriter.ExcelTableWriter()
writer.open_workbook("sample_single.xlsx")
writer.make_worksheet("zone")
writer.header_list = ["zone_id", "country_code", "zone_name"]
writer.value_matrix = [
["1", "AD", "Europe/Andorra"],
["2", "AE", "Asia/Dubai"],
["3", "AF", "Asia/Kabul"],
["4", "AG", "America/Antigua"],
["5", "AI", "America/Anguilla"],
]
writer.write_table()
writer.close()
Output
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. figure:: ss/excel_single.png
:scale: 100%
:alt: excel_single
Output excel file (``sample_single.xlsx``)
For more information
--------------------
More examples are available at
http://pytablewriter.readthedocs.org/en/latest/pages/examples/index.html
Installation
============
::
pip install pytablewriter
Dependencies
============
Python 2.7+ or 3.3+
- `DataPropery <https://github.com/thombashi/DataProperty>`__
- `dominate <http://github.com/Knio/dominate/>`__
- `pathvalidate <https://github.com/thombashi/pathvalidate>`__
- `six <https://pypi.python.org/pypi/six/>`__
- `XlsxWriter <http://xlsxwriter.readthedocs.io/>`__
Test dependencies
-----------------
- `pytest <http://pytest.org/latest/>`__
- `pytest-runner <https://pypi.python.org/pypi/pytest-runner>`__
- `SimpleSQLite <https://github.com/thombashi/SimpleSQLite>`__
- `tox <https://testrun.org/tox/latest/>`__
Documentation
=============
http://pytablewriter.readthedocs.org/en/latest/
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
pytablewriter-0.1.0.tar.gz
(192.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytablewriter-0.1.0.tar.gz.
File metadata
- Download URL: pytablewriter-0.1.0.tar.gz
- Upload date:
- Size: 192.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49df4e46bfe08d6f73cc5eef2a7dc4761f5b7b892220a11c17663af997465a8f
|
|
| MD5 |
b1c4deaf9e0c7d0794b736f932976e38
|
|
| BLAKE2b-256 |
94e432bfce1230c4e4308d1e1aefbe8fc86e1061d544843f3bfd943a7378bf46
|
File details
Details for the file pytablewriter-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: pytablewriter-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
555d2647abc60ec0f818037ba8e0e24fd88e45769ca45b33e8d422e2098e63e4
|
|
| MD5 |
25f704dffdc8b7f4bc4c796fa4e5020e
|
|
| BLAKE2b-256 |
256e5dad60d75812587e692e728ed8e405f3b959e9ff609b432954acfbb4b4a4
|