def _make_df_square(table):

    if not isinstance(table, pd.DataFrame):
        return table

    # If the table is not square, make it square
    if table.shape[0] != table.shape[1]:
        ix = list(set(table.index) | set(table.columns))
        table = table.reindex(ix, axis=0)
        table = table.reindex(ix, axis=1)

    # Ensures that the rows and columns are in the same order.
    table = table.reindex(table.columns)

    return table
Reindex a pandas DataFrame so that it becomes square, meaning that
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/stats/contingency_tables.py/_make_df_square