macpie.DatasetFields#
- class macpie.DatasetFields(*args, **kwargs)#
A tabular representation of a set of
macpie.Datasetfields. First column is the Dataset name. Second column is the Dataset column name.It is a subclass of
macpie.tablibtools.MacpieTablibDataset, and therefore can be initialized with data the same way.- __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])append_series(ser[, with_tags, tag_value])Adds
seras a row todsetwith tags derived from the labels inserthat are not headers indset, and whose value is'x'or'X'.compare(other)Compare this MacpieTablibDataset with another.
export(format, **kwargs)Export
Datasetobject to format.extend(rows[, tags])Adds a list of rows to the
Datasetusing :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_collection(collection, **kwargs)Construct
DatasetFieldsfrom a MACPie Collection.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
Datasetat 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
Datasetat the given index.insert_col(index[, col, header])Inserts a column to the
Datasetat the given index.insert_separator(index[, text])Adds a separator to
Datasetat given index.load(in_stream[, format])Import in_stream to the
Datasetobject 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
Datasetobject 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(collection)Sort the Dataset fields according to the order they have in their respective collections.
stack(other)Stack two
Datasetinstances together by joining at the row level, and return new combinedDatasetinstance.stack_cols(other)Stack two
Datasetinstances together by joining at the column level, and return a new combinedDatasetinstance.subset(*args, **kwargs)Returns a new instance of the
Dataset, including only specified rows and columns.to_dict()Convert this
DatasetFieldsto a dictionary.to_excel(excel_writer)Write to an excel file using an
MACPieExcelWriterinstance.transpose()Transpose a
Dataset, turning rows into columns and vice versa, returning a newDatasetinstance.wipe()Removes all content and headers from the
Datasetobject.wipe_data()Removes all content (but not headers).
Attributes
dataData of Dataset.
dfGet
pandas.DataFramerepresentation of data.dictA native Python representation of the
Datasetobject.headersAn optional list of strings to be used for header rows and attribute names.
heightThe number of rows currently in the
Dataset.tag_key_fieldTag to indicate key fields
tag_non_key_fieldTag to indicate non-key fields
tag_sys_fieldTag to indicate system fields
unique_datasetsA list of unique
macpie.Datasetnames.widthThe number of columns currently in the
Dataset.