DVector.filter_segment_value#

DVector.filter_segment_value(segment_name, segment_values, keep_filtered=False)[source]#

Filter a DVector on a given segment.

Equivalent to .loc/.xs in pandas.

Parameters:
  • segment_name (str) – The name of the segment to filter by.

  • segment_values (int | list[int]) – The segment values to filter by. If an int is given, the segment is dropped from the returned DVector, otherwise the output DVector will contain a subset of the segment.

  • keep_filtered (bool = False) – Whether to keep the segment being filtered on.

Return type:

DVector