Data

Tags for data sources

class disseminate.tags.data.Cell(name, content, attributes, context)

Bases: disseminate.tags.tag.Tag

A cell in a table

tex_fmt(**kwargs)

Format the tag in LaTeX format.

Parameters
contentOptional[Union[str, List[Union[str, list, Tag]]]

Specify an alternative content from the tag’s content. It can either be a string, a tag or a list of strings, tags and lists.

attributesOptional[Union[str, Attributes]]

Specify an alternative attributes dict from the tag’s attributes. It can either be a string or an attributes dict.

mathmodeOptional[bool]

If True, the tag will be rendered in math mode. Otherwise (default) latex text mode is assumed.

levelOptional[int]

The level of the tag.

Returns
tex_stringstr

The formatted tex string.

class disseminate.tags.data.Data(name, content, attributes, context)

Bases: disseminate.tags.tag.Tag

A container for data.

Attributes
dataDict[Union[str, int], Tuple(str)]

A data dict with the column names (str) or column index (int) as keys and the rows (tuple) as values.

processed_headersUnion[List[tags.Tag], None]

The headers processed into tags

processed_rowsList[List[tags.tag]]

The rows processed into tags

property headers

The tuple of the data headers

abstract load(filepath_or_buffer)

Load the dataframe from a filepath or a string buffer.

Parameters
filepath_or_bufferUnion[pathlib.Path, str, io.StringIO]

The filename and path (filepath) or string buffer.

property num_cols

The number of columns in the data

property num_rows

The number of columns in the data

process_tags()

Process the tags for the items in the tag’s data.

property rows

An iterator for the data rows

property rows_transpose

An iterator for the data rows (transposed)

class disseminate.tags.data.DelimData(delimiter=',', *args, **kwargs)

Bases: disseminate.tags.data.Data

A container for delimiter data (ex: comma-separated values)

load(filepath_or_buffer, delimiter=None)

Load the dataframe from a filepath or a string buffer.

Parameters
filepath_or_bufferUnion[pathlib.Path, str, io.StringIO]

The filename and path (filepath) or string buffer.

class disseminate.tags.data.HeaderCell(name, content, attributes, context)

Bases: disseminate.tags.tag.Tag

A header cell in a table

tex_fmt(**kwargs)

Format the tag in LaTeX format.

Parameters
contentOptional[Union[str, List[Union[str, list, Tag]]]

Specify an alternative content from the tag’s content. It can either be a string, a tag or a list of strings, tags and lists.

attributesOptional[Union[str, Attributes]]

Specify an alternative attributes dict from the tag’s attributes. It can either be a string or an attributes dict.

mathmodeOptional[bool]

If True, the tag will be rendered in math mode. Otherwise (default) latex text mode is assumed.

levelOptional[int]

The level of the tag.

Returns
tex_stringstr

The formatted tex string.