This module contains reporting utilities.
Builds a pandas DataFrame, by updating a dict incrementally.
The actual DataFrame is built at the end of the build process.
Variables: |
|
---|
Builds a pandas DataFrame from an internal dict.
Parameters: | index – A list representing the DataFrame index. |
---|---|
Returns: | A pandas DataFrame. |
Adds a row to the pandas DataFrame
Parameters: | row – A list of values to add. |
---|---|
Returns: | A table-like dict. |
>>> from dautil import report
>>> builder = report.DFBuilder(['A', 'B'])
>>> row = list(range(2))
>>> builder.row(row)
{'B': [1], 'A': [0]}
>>> builder.df
{'B': [1], 'A': [0]}
Builds a HTML string.
Variables: | html – A string representing HTML. |
---|
Adds arbitrary html.
Parameters: | txt – The html to add. |
---|
>>> from dautil import report
>>> hb = report.HTMLBuilder()
>>> hb.add('<p>42</p>')
>>> hb.html
'<div><p>42</p></div><br/>'
Converts a pandas DataFrame to HTML and adds it.
Parameters: |
|
---|
Adds a first level heading.
Parameters: | heading – The text of the heading. |
---|
Adds a second level heading.
Parameters: | heading – The text of the heading. |
---|
>>> from dautil import report
>>> hb = report.HTMLBuilder()
>>> hb.h2('Heading 2')
>>> hb.html
'<h2 style="color:gray;">Heading 2</h2><br/>'
Adds a watermark containing versions of detected software libraries.
Returns: | The HTML of the watermark. |
---|
Writes a reStructured text file.
Variables: | rst – A string representing reStructured text. |
---|
Adds arbitrary text.
Parameters: | txt – The text to add. |
---|
Adds a divider.
Adds a first level heading.
Parameters: | txt – The text of the heading. |
---|
Writes to a file.
Parameters: | fname – The name of the file. |
---|
Apply a function to the cells of a grid.
Parameters: |
|
---|---|
Returns: | A pandas DataFrame containing the result. |