mirror of
https://github.com/KevinMidboe/tableprint.git
synced 2025-10-29 18:00:16 +00:00
updates docs
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
.. _api:
|
||||
|
||||
===
|
||||
API
|
||||
===
|
||||
|
||||
.. automodule:: tableprint
|
||||
:members:
|
||||
|
||||
|
||||
16
docs/conf.py
16
docs/conf.py
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# TablePrint documentation build configuration file, created by
|
||||
# Tableprint documentation build configuration file, created by
|
||||
# sphinx-quickstart on Wed Sep 30 13:40:02 2015.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
@@ -53,7 +53,7 @@ source_suffix = '.rst'
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'TablePrint'
|
||||
project = u'Tableprint'
|
||||
copyright = u'2015, Niru Maheswaranathan'
|
||||
author = u'Niru Maheswaranathan'
|
||||
|
||||
@@ -207,7 +207,7 @@ html_static_path = ['_static']
|
||||
#html_search_scorer = 'scorer.js'
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'TablePrintdoc'
|
||||
htmlhelp_basename = 'Tableprintdoc'
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
@@ -229,7 +229,7 @@ latex_elements = {
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, 'TablePrint.tex', u'TablePrint Documentation',
|
||||
(master_doc, 'Tableprint.tex', u'Tableprint Documentation',
|
||||
u'Niru Maheswaranathan', 'manual'),
|
||||
]
|
||||
|
||||
@@ -259,7 +259,7 @@ latex_documents = [
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'tableprint', u'TablePrint Documentation',
|
||||
(master_doc, 'tableprint', u'Tableprint Documentation',
|
||||
[author], 1)
|
||||
]
|
||||
|
||||
@@ -273,8 +273,8 @@ man_pages = [
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'TablePrint', u'TablePrint Documentation',
|
||||
author, 'TablePrint', 'One line description of project.',
|
||||
(master_doc, 'Tableprint', u'Tableprint Documentation',
|
||||
author, 'Tableprint', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
@@ -292,4 +292,4 @@ texinfo_documents = [
|
||||
|
||||
|
||||
# Example configuration for intersphinx: refer to the Python standard library.
|
||||
intersphinx_mapping = {'https://docs.python.org/': None}
|
||||
intersphinx_mapping = {'https://docs.python.org/3': None}
|
||||
|
||||
@@ -1,23 +1,58 @@
|
||||
.. TablePrint documentation master file, created by
|
||||
sphinx-quickstart on Wed Sep 30 13:40:02 2015.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
==========
|
||||
Tableprint
|
||||
==========
|
||||
|
||||
Welcome to TablePrint's documentation!
|
||||
======================================
|
||||
Tableprint is a library for printing out numerical data in Ascii formatted tables. Check it out on `Github`_!
|
||||
|
||||
Contents:
|
||||
.. _Github: https://github.com/nirum/tableprint/
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
quickstart
|
||||
examples
|
||||
api
|
||||
Installation
|
||||
------------
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
First, we need to install the module. We can do that using pip:
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
.. code-block:: bash
|
||||
|
||||
$ pip install tableprint
|
||||
|
||||
Quickstart
|
||||
----------
|
||||
|
||||
Now let's see what we can do. Tableprint offers two functions that print a table directly,
|
||||
``tableprint.table`` and ``tableprint.frame``. The first takes a numpy array and a list of
|
||||
headers, whereas the second takes a pandas DataFrame as input. For example, you can do the following:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
>>> tableprint.table(np.random.randn(10,3), ['A', 'B', 'C'])
|
||||
|
||||
If you want to append to a table on the fly, you can use the functions ``tableprint.header``,
|
||||
``tableprint.row``, and ``tableprint.hr``. These functions return an ASCII formatted string
|
||||
given a list of headers, an array of data, and a number of columns, respectively. For example
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
>>> print(tableprint.hr(3))
|
||||
>>> print(tableprint.header(['A', 'B', 'C']))
|
||||
>>> print(tableprint.hr(3))
|
||||
>>> for ix in range(10):
|
||||
|
||||
# insert time-intensive data collection here
|
||||
data = np.random.randn(3)
|
||||
|
||||
# print data to stdout
|
||||
print(tableprint.row(data), flush=True)
|
||||
|
||||
>>> print(tableprint.hr(3))
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
Tableprint comes with a number of options, these are fully described below:
|
||||
|
||||
.. autofunction:: tableprint.table
|
||||
.. autofunction:: tableprint.frame
|
||||
.. autofunction:: tableprint.header
|
||||
.. autofunction:: tableprint.row
|
||||
.. autofunction:: tableprint.hr
|
||||
.. autofunction:: tableprint.humantime
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
==========
|
||||
TablePrint
|
||||
==========
|
||||
|
||||
`tableprint`_ is a library for printing out numerical data in Ascii formatted tables.
|
||||
|
||||
.. _tableprint: https://github.com/nirum/tableprint/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user