BipartiteEventStudyCollapsed class

class bipartitepandas.bipartiteeventstudycollapsed.BipartiteEventStudyCollapsed(*args, col_reference_dict=None, col_collapse_dict=None, **kwargs)

Bases: BipartiteEventStudyBase

Class for bipartite networks of firms and workers in collapsed event study form (i.e. employment spells are collapsed into a single observation). Inherits from BipartiteEventStudyBase.

Parameters
  • *args – arguments for BipartiteEventStudyBase

  • 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 BipartiteEventStudyBase

get_worker_m(is_sorted=False)

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

Parameters

is_sorted (bool) – not used for collapsed event study format

Returns

indicates whether the worker associated with each observation is a mover

Return type

(NumPy Array)

uncollapse(drop_no_collapse_columns=True, is_sorted=False, copy=True)

Return collapsed event study data reformatted into event study data, by assuming variables constant over spells.

Parameters
  • drop_no_collapse_columns (bool) – if True, columns marked by self.col_collapse_dict as None (i.e. they should be dropped) will be dropped

  • 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 reformatted as event study data

Return type

(BipartiteEventStudy)