Categories
paper-pptx 0.2.0 API reference
A sequence of data.Category objects, also having certain hierarchical
graph behaviors for support of multi-level (nested) categories.
Categories()Attributes
are_dates
attributeare_datesReturn True if the first category in this collection has a date
label (as opposed to str or numeric). A date label is one of type
datetime.date or datetime.datetime. Returns False otherwise,
including when this category collection is empty. It also returns
False when this category collection is hierarchical, because
hierarchical categories can only be written as string labels.
are_numeric
attributeare_numericReturn True if the first category in this collection has a numeric
label (as opposed to a string label), including if that value is
a datetime.date or datetime.datetime object (as those are converted
to integers for storage in Excel). Returns False otherwise,
including when this category collection is empty. It also returns
False when this category collection is hierarchical, because
hierarchical categories can only be written as string labels.
depth
attributedepthThe number of hierarchy levels in this category graph. Returns 0 if it contains no categories.
leaf_count
attributeleaf_countThe number of leaf-level categories in this hierarchy. The return
value is the same as that of len() only when the hierarchy is
single level.
levels
attributelevelsA generator of (idx, label) sequences representing the category hierarchy from the bottom up. The first level contains all leaf categories, and each subsequent is the next level up.
number_format
attributenumber_formatRead/write. Return a string representing the number format used in
Excel to format these category values, e.g. '0.0' or 'mm/dd/yyyy'.
This string is only relevant when the categories are numeric or date
type, although it returns 'General' without error when the categories
are string labels. Assigning None causes the default number format
to be used, based on the type of the category labels.
Functions
__getitem__
func__getitem__(idx)paramidx__len__
func__len__()Return the count of the highest level of category in this sequence.
If it contains hierarchical (multi-level) categories, this number
will differ from :attr:category_count, which is the number of leaf
nodes.
add_category
funcadd_category(label)Return a newly created data.Category object having label and
appended to the end of this category sequence. label can be
a string, a number, a datetime.date, or datetime.datetime object. All
category labels in a chart must be the same type. All category labels
in a chart having multi-level categories must be strings.
Creating a chart from chart data having date categories will cause
the chart to have a DateAxis for its category axis.
paramlabelindex
funcindex(category)The offset of category in the overall sequence of leaf categories. A non-leaf category gets the index of its first sub-category.
paramcategory