BipartiteExtendedEventStudy class

class bipartitepandas.bipartiteextendedeventstudy.BipartiteExtendedEventStudy(*args, n_periods=4, col_reference_dict=None, col_collapse_dict=None, **kwargs)

Bases: BipartiteExtendedEventStudyBase

Class for bipartite networks of firms and workers in extended event study form. Inherits from BipartiteExtendedEventStudyBase.

Parameters
  • *args – arguments for BipartiteExtendedEventStudyBase

  • n_periods (int) – number of periods in extended event study

  • col_reference_dict (dict or None) – clarify which columns are associated with a general column name, e.g. {‘i’: ‘i’, ‘j’: [‘j1’, ‘j2’]}; None is equivalent to {}

  • col_collapse_dict (dict or None) – how to collapse column (None indicates the column should be dropped), e.g. {‘y’: ‘mean’}; None is equivalent to {}

  • **kwargs – keyword arguments for BipartiteExtendedEventStudyBase

collapse(level='spell', is_sorted=False, copy=True)

Collapse extended event study data at the worker-firm spell level (so each spell for a particular worker at a particular firm becomes one observation).

Parameters
  • level (str) – if ‘spell’, collapse at the worker-firm spell level; if ‘match’, collapse at the worker-firm match level (‘spell’ and ‘match’ will differ if a worker leaves then returns to a firm)

  • is_sorted (bool) – if False, dataframe will be sorted by i (and t, if included). Returned dataframe will be sorted. Sorting may alter original dataframe if copy is set to False. Set is_sorted to True if dataframe is already sorted.

  • copy (bool) – if False, avoid copy

Returns

collapsed event study data generated by collapsing event study data at the worker-firm spell level

Return type

(BipartiteEventStudyCollapsed)

get_worker_m(is_sorted=False)

Get NumPy array indicating whether the worker associated with each observation is a mover.

Parameters

is_sorted (bool) – if False, dataframe will be sorted by i in a groupby (but self will not be not sorted). Set to True if dataframe is already sorted.

Returns

indicates whether the worker associated with each observation is a mover

Return type

(NumPy Array)