Beispiel #1
0
def display_unitroot(df: pd.DataFrame,
                     target: str,
                     fuller_reg: str,
                     kpss_reg: str,
                     export: str = ""):
    """Show unit root test calculations

    Parameters
    ----------
    df : pd.DataFrame
        DataFrame
    target : str
        Column of data to look at
    fuller_reg : str
        Type of regression of ADF test
    kpss_reg : str
        Type of regression for KPSS test
    export : str
        Format for exporting data
    """
    df = df[target]
    data = qa_model.get_unitroot(df, fuller_reg, kpss_reg)
    if gtff.USE_TABULATE_DF:
        print(
            tabulate(
                data,
                showindex=True,
                headers=data.columns,
                tablefmt="fancy_grid",
                floatfmt=".4f",
            ),
            "\n",
        )
    else:
        print(data.round(4).to_string(), "\n")

    export_data(
        export,
        os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
        "unitroot",
        data,
    )
Beispiel #2
0
def display_unitroot(df: pd.DataFrame,
                     target: str,
                     fuller_reg: str,
                     kpss_reg: str,
                     export: str = ""):
    """Show unit root test calculations

    Parameters
    ----------
    df : pd.DataFrame
        DataFrame
    target : str
        Column of data to look at
    fuller_reg : str
        Type of regression of ADF test
    kpss_reg : str
        Type of regression for KPSS test
    export : str
        Format for exporting data
    """
    df = df[target]
    data = qa_model.get_unitroot(df, fuller_reg, kpss_reg)
    print_rich_table(
        data,
        show_index=True,
        headers=list(data.columns),
        title="[bold]Unit Root Calculation[/bold]",
        floatfmt=".4f",
    )
    console.print("")
    export_data(
        export,
        os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
        "unitroot",
        data,
    )