Segments/Dimensional

Data from dimensionalized tables, operating and geographic segments for example. The data behind the Calcbench Segment page www.calcbench.com/segments.

calcbench.dimensional.dimensional(company_identifiers=[], metrics=[], start_year=None, start_period=None, end_year=None, end_period=None, period_type=PeriodType.Annual, all_history=True, trace_url=False, as_originally_reported=False)

Segments and Breakouts in a DataFrame

The data behind the breakouts/segment page, https://www.calcbench.com/breakout.

If there are no results an empty dataframe is returned

Parameters:
  • company_identifiers (sequence) – Tickers/CIK codes. eg. [‘msft’, ‘goog’, ‘appl’, ‘0000066740’]

  • metrics (Sequence[str]) – Specific line item to get, for instance OperatingSegmentRevenue or ConcentrationRiskPercentageCustomer, get the list @ https://www.calcbench.com/api/availableBreakouts, pass in the “databaseName”

  • start_year (int) – first year of data to get

  • start_period (Union[Period, Literal[0, 1, 2, 3, 4], None]) – first period of data to get. 0 for annual data, 1, 2, 3, 4 for quarterly data.

  • end_year (int) – last year of data to get

  • end_period (Union[Period, Literal[0, 1, 2, 3, 4], None]) – last period of data to get. 0 for annual data, 1, 2, 3, 4 for quarterly data.

  • period_type (PeriodType) – only applicable when other period data not supplied.

  • trace_url (bool) – include a column with URL that point to the source document.

  • as_originally_reported (bool) – Show the first reported, rather than revised, values

Returns:

A list of points. The points correspond to the lines @ https://www.calcbench.com/breakout. For each requested metric there will be a the formatted value and the unformatted value denote bya _effvalue suffix. The label is the dimension label associated with the values.

Return type:

pd.DataFrame

Usage:

>>> cb.dimensional(
>>>   company_identifiers=cb.tickers(index="DJIA"),
>>>   metrics=["OperatingSegmentRevenue", "OperatingSegmentOperatingIncome"],
>>>   period_type="annual",
>>> )
calcbench.dimensional.dimensional_raw(company_identifiers=[], metrics=[], start_year=None, start_period=None, end_year=None, end_period=None, period_type=PeriodType.Annual, all_history=True, as_originally_reported=False)

Segments and Breakouts

The data behind the breakouts/segment page, https://www.calcbench.com/breakout.

Parameters:
  • company_identifiers (Sequence[Union[str, int]]) – Tickers/CIK codes. eg. [‘msft’, ‘goog’, ‘appl’, ‘0000066740’]

  • metrics (Sequence[str]) – Specific line item to get, for instance OperatingSegmentRevenue or ConcentrationRiskPercentageCustomer, get the list @ https://www.calcbench.com/api/availableBreakouts, pass in the “databaseName”

  • start_year (Optional[int]) – first year of data to get

  • start_period (Union[Period, Literal[0, 1, 2, 3, 4], None]) – first period of data to get.

  • end_year (Optional[int]) – last year of data to get

  • end_period (Union[Period, Literal[0, 1, 2, 3, 4], None]) – last period of data to get.

  • period_type (PeriodType) – Only applicable when other period data not supplied.

  • all_history (bool) – Get data for all history

  • as_originally_reported (bool) – Show the first reported, rather than revised, values

Return type:

Sequence[DimensionalDataPoint]

Usage::
>>> cb.dimensional_raw(company_identifiers=['fdx'],
>>>   metrics=['OperatingSegmentRevenue'],
>>>   start_year=2018
>>> )