pyexlatex.table.models.data package

Submodules

pyexlatex.table.models.data.dataitem module

class pyexlatex.table.models.data.dataitem.DataItem(value)[source]

Bases: mixins.repr.ReprMixin, pyexlatex.table.models.mixins.addvalues.row.RowAddMixin

__init__(value)[source]
repr_cols: List[str] = ['value']

pyexlatex.table.models.data.row module

class pyexlatex.table.models.data.row.DataRow(values)[source]

Bases: pyexlatex.table.models.table.row.Row

values: Sequence

pyexlatex.table.models.data.table module

class pyexlatex.table.models.data.table.DataTable(values_table, column_labels=None, row_labels=None, top_left_corner_labels=None, break_size_adjustment=None, skip_add_top_left_to_column_labels=False)[source]

Bases: pyexlatex.table.models.table.section.TableSection, mixins.repr.ReprMixin

Represents a subsection in a panel, but tracks row and column labels, which may be consolidated when assembled into Panels then a Table

Use DataTable.from_df to create a DataTable from a pandas DataFrame.

__init__(values_table, column_labels=None, row_labels=None, top_left_corner_labels=None, break_size_adjustment=None, skip_add_top_left_to_column_labels=False)[source]
property column_labels
classmethod from_df(df, include_columns=True, include_index=False, extra_header=None, extra_header_underline=True, top_left_corner_labels=None, **kwargs)[source]

Use for the most fine-grained control in creating tables. Construct DataTables from pandas DataFrames, modify labels as needed, assemble them into Panels, then create a latex Table with Table.from_panel_list.

Parameters
  • df (DataFrame) –

  • include_columns

  • include_index

  • extra_header (Optional[str]) – extra headers to place over the existing column labels (or over values if there are no column labels). Useful when placing multiple DataTables horizontally in a Panel. If a str is passed, str will become a multicolumn header for the entire DataTable. If a list of as many strs as there are columns is passed, these will be placed above any existing column labels. LabelTable and LabelCollection objects may also be passed for more control. When those objects are passed, the extra_header_underline argument is ignored.

  • extra_header_underline – whether to add an underline under the extra header, if the extre header was passed

  • top_left_corner_labels (Union[LabelTable, LabelCollection, List[AnyStr], AnyStr, None]) – additional labels to place in the top left corner. pass a single string or a list of strings for convenience. a list of strings will be create labels which span the gap horizontally and go downwards, one label per row. pass LabelCollection or LabelTable for more control.

  • kwargs – DataTable kwargs

Returns

property has_column_labels: bool
Return type

bool

property has_row_labels: bool
Return type

bool

repr_cols: List[str] = ['values_table', 'column_labels', 'row_labels']
property row_labels
property rows
property should_add_top_left: bool
Return type

bool

property values_table

pyexlatex.table.models.data.valuestable module

class pyexlatex.table.models.data.valuestable.ValuesTable(rows, break_size_adjustment=None)[source]

Bases: pyexlatex.table.models.table.section.TableSection

Python interface for a part of a table containing rows and columns with values

__init__(rows, break_size_adjustment=None)[source]
classmethod from_df(df)[source]
classmethod from_list_of_lists(list_of_lists)[source]