gooddata_pandas.series.SeriesFactory

class gooddata_pandas.series.SeriesFactory(sdk: gooddata_sdk.sdk.GoodDataSdk, workspace_id: str)

Bases: object

__init__(sdk: gooddata_sdk.sdk.GoodDataSdk, workspace_id: str) None

Methods

__init__(sdk, workspace_id)

indexed(index_by, data_by[, filter_by])

Creates pandas Series from data points calculated from a single data_by that will be computed on granularity of the index labels.

not_indexed(data_by[, granularity, filter_by])

Creates pandas Series from data points calculated from a single data_by that will be computed on granularity of the specified labels.

indexed(index_by: IndexDef, data_by: Union[SimpleMetric, str, ObjId, Attribute], filter_by: Optional[Union[Filter, list[Filter]]] = None) pandas.Series

Creates pandas Series from data points calculated from a single data_by that will be computed on granularity of the index labels. The elements of the index labels will be used to construct simple or hierarchical index.

Parameters
  • index_by

    label to index by; specify either:

    • string with id: ‘some_label_id’,

    • object identifier: ObjId(id=’some_label_id’, type=’label’),

    • string representation of object identifier: ‘label/some_label_id’

    • or an Attribute object used in the compute model: Attribute(local_id=…, label=’some_label_id’)

    • dict containing mapping of index name to label to use for indexing - specified in one of the ways list above

  • data_by

    label, fact or metric to that will provide data (metric values or label elements); specify either:

    • object identifier: ObjId(id=’some_id’, type=’<type>’) - where type is either ‘label’, ‘fact’ or ‘metric’

    • string representation of object identifier: ‘<type>/some_id’ - where type is either ‘label’, ‘fact’ or ‘metric’

    • Attribute object used in the compute model: Attribute(local_id=…, label=’some_label_id’)

    • SimpleMetric object used in the compute model: SimpleMetric(local_id=…, item=…, aggregation=…)

  • filter_by – optionally specify filter to apply during computation on the server, reference to filtering column can be one of: - string reference to index key - object identifier in string form - object identifier: ObjId(id=’some_label_id’, type=’<type>’) - Attribute or Metric depending on type of filter

:return pandas series instance

not_indexed(data_by: Union[SimpleMetric, str, ObjId, Attribute], granularity: Union[list[LabelItemDef], IndexDef] = None, filter_by: Optional[Union[Filter, list[Filter]]] = None) pandas.Series

Creates pandas Series from data points calculated from a single data_by that will be computed on granularity of the specified labels. No index will be constructed.

Note that data_by may also be a label in which case the Series will contain label elements.

Parameters
  • data_by

    label, fact or metric to get data from; specify either:

    • object identifier: ObjId(id=’some_id’, type=’<type>’) - where type is either ‘label’, ‘fact’ or ‘metric’

    • string representation of object identifier: ‘<type>/some_id’ - where type is either ‘label’, ‘fact’ or ‘metric’

    • Attribute object used in the compute model: Attribute(local_id=…, label=’some_label_id’)

    • SimpleMetric object used in the compute model: SimpleMetric(local_id=…, item=…, aggregation=…)

  • granularity

    optionally specify label to slice the metric by; specify either:

    • string with id: ‘some_label_id’,

    • object identifier: ObjId(id=’some_label_id’, type=’label’),

    • string representation of object identifier: ‘label/some_label_id’

    • or an Attribute object used in the compute model: Attribute(local_id=…, label=’some_label_id’)

    • list containing multiple labels to slice the metric by - specified in one of the ways list above

    • dict containing mapping of index name to label to use for indexing - specified in one of the ways list above; this option is available so that you can easily switch from indexed factory method to this one if needed

  • filter_by – optionally specify filter to apply during computation on the server, reference to filtering column can be one of: - object identifier in string form - object identifier: ObjId(id=’some_label_id’, type=’<type>’) - Attribute or Metric depending on type of filter

:return pandas series instance