DVector.add_segments#
- DVector.add_segments(new_segs, new_naming_order=None, split_method='duplicate', splitter=None)[source]#
Add a segment to a DVector.
The new segment will multiply the length of the DVector, usually by the length of the new segment (but less if an exclusion is introduced between the new segment and the current segmentation).
- Parameters:
new_segs (Segment) – The new segment to be added. This will be checked and added as an enum_segment if it exists as such, and as a custom segment if not. This must be provided as a Segment type, and can’t be a string to pass to the SegmentSuper enum class
new_naming_order (Optional[list[str]] = None) – The naming order of the resultant segmentation. If not provided, the new segment will be appended to the end.
split_method (Literal["split", "duplicate"] = "duplicate") – How to deal with the values in the current DVector. “split” will split values into the new segment, conserving the sum of the current DVector. Duplicate will keep all values the same and duplicate them into the new DVector.
splitter (pd.Series | None = None) – A series with the expanded index. Self.data will be multiplied by this to expand its segmentation. If this isn’t provided it will be all ones.
- Return type: