macpie.tablibtools.MacpieTablibDataset#
- class macpie.tablibtools.MacpieTablibDataset(*args, **kwargs)#
Extend
tablib.Dataset
with extra functionality.- __init__(*args, **kwargs)#
Methods
__init__
(*args, **kwargs)add_formatter
(col, handler)Adds a formatter to the
Dataset
.append
(row[, tags])Adds a row to the
Dataset
. See :method:`Dataset.insert` for additional documentation.append_col
(col[, header])Adds a column to the
Dataset
. See :method:`Dataset.insert_col` for additional documentation.append_col_fill
(fill_value[, header])Adds a column to the Dataset with a specified fill_value.
append_separator
([text])Adds a separator to the
Dataset
.append_series
(ser[, with_tags, tag_value])Adds
ser
as a row todset
with tags derived from the labels inser
that are not headers indset
, and whose value is'x'
or'X'
.compare
(other)Compare this MacpieTablibDataset with another.
export
(format, **kwargs)Export
Dataset
object to format.extend
(rows[, tags])Adds a list of rows to the
Dataset
using :method:`Dataset.append`extendleft
(rows[, tags])Prepend a list of Dataset fields.
filter
(tag)Returns a new instance of the
Dataset
, excluding any rows that do not contain the given tags.from_df
(df[, title])Construct instance from a
pandas.DataFrame
.from_excel
(filepath[, sheet_name, headers, ...])Construct instance from an Excel sheet.
from_tablib_dset
(dset, *args, **kwargs)get_cli
(**kwargs)get_col
(index)Returns the column from the
Dataset
at the given index.get_csv
(**kwargs)get_dbf
(**kwargs)get_df
(**kwargs)get_jira
(**kwargs)get_json
(**kwargs)get_latex
(**kwargs)get_rst
(**kwargs)get_tsv
(**kwargs)get_xlsx
(**kwargs)insert
(index, row[, tags])Inserts a row to the
Dataset
at the given index.insert_col
(index[, col, header])Inserts a column to the
Dataset
at the given index.insert_separator
(index[, text])Adds a separator to
Dataset
at given index.load
(in_stream[, format])Import in_stream to the
Dataset
object using the format.lpop
()Removes and returns the first row of the
Dataset
.lpush
(row[, tags])Adds a row to the top of the
Dataset
. See :method:`Dataset.insert` for additional documentation.lpush_col
(col[, header])Adds a column to the top of the
Dataset
. See :method:`Dataset.insert` for additional documentation.pop
()Removes and returns the last row of the
Dataset
.print
()Print a representation table suited to a terminal in grid format.
remove_duplicates
()Removes all duplicate rows from the
Dataset
object while maintaining the original order.rpop
()Removes and returns the last row of the
Dataset
.rpush
(row[, tags])Adds a row to the end of the
Dataset
. See :method:`Dataset.insert` for additional documentation.rpush_col
(col[, header])Adds a column to the end of the
Dataset
. See :method:`Dataset.insert` for additional documentation.set_cli
(in_stream, **kwargs)set_csv
(in_stream, **kwargs)set_dbf
(in_stream, **kwargs)set_df
(in_stream, **kwargs)set_jira
(in_stream, **kwargs)set_json
(in_stream, **kwargs)set_latex
(in_stream, **kwargs)set_rst
(in_stream, **kwargs)set_tsv
(in_stream, **kwargs)set_xlsx
(in_stream, **kwargs)sort
(col[, reverse])Sort a
Dataset
by a specific column, given string (for header) or integer (for column index).stack
(other)Stack two
Dataset
instances together by joining at the row level, and return new combinedDataset
instance.stack_cols
(other)Stack two
Dataset
instances together by joining at the column level, and return a new combinedDataset
instance.subset
(*args, **kwargs)Returns a new instance of the
Dataset
, including only specified rows and columns.to_excel
(excel_writer)Write to an excel file using an
MACPieExcelWriter
instance.transpose
()Transpose a
Dataset
, turning rows into columns and vice versa, returning a newDataset
instance.wipe
()Removes all content and headers from the
Dataset
object.wipe_data
()Removes all content (but not headers).
Attributes
data
Data of Dataset.
df
Get
pandas.DataFrame
representation of data.dict
A native Python representation of the
Dataset
object.headers
An optional list of strings to be used for header rows and attribute names.
height
The number of rows currently in the
Dataset
.width
The number of columns currently in the
Dataset
.