macrosynergy.panel.imputers#
- impute_panel(df, cids, xcats, threshold=0.5, start_date=None, impute_empty_tickers=False)[source]#
Imputes missing values for each category in a long-format panel dataset by a cross- sectional mean, conditional on the number of available cross-sections at each concerned date exceeding a fraction threshold of the total number of cross- sections.
- Parameters:
df (DataFrame) – the long-format panel dataset
cids (list) – the list of cross sections to be considered in the imputation
xcats (list) – the list of categories to be imputed
threshold (float) – the fraction of available cross-sections at each date
start_date (str) – the starting date for the imputation
impute_empty_tickers (bool) – boolean flag for whether to impute missing values for empty tickers
- Returns:
the imputed long-format panel data with columns
- Return type:
Note
This class is still experimental: the predictions and the API might change without any deprecation cycle.