コード例 #1
0
def test_make_recurrent_no_partitioning4():
    ORDER_BY = "times"
    N_RECURRENT_SAMPLES = 5

    df = sample_data2()
    arr, y = make_recurrent(df, N_RECURRENT_SAMPLES, ORDER_BY, verbose=True, price_column="val1", time_threshold=86400)
    check_results(arr, df, N_RECURRENT_SAMPLES)
コード例 #2
0
def test_make_recurrent_partitioning4():
    ORDER_BY = "times"
    PARTITION_BY = "day"
    N_RECURRENT_SAMPLES = 3

    df = sample_data2()
    df[PARTITION_BY] = pd.to_datetime(df["times"]).dt.to_period("D")
    arr, y = make_recurrent(df, N_RECURRENT_SAMPLES, ORDER_BY, PARTITION_BY, verbose=True, price_column="val1", time_threshold=86400)
    check_results(arr, df, N_RECURRENT_SAMPLES, PARTITION_BY)
コード例 #3
0
ファイル: example1.py プロジェクト: mhernan88/reshape_tools
def main():
    df = sample_data1()
    arr = make_recurrent(df,
                         3,
                         "times",
                         drop_order_by=False,
                         drop_partition_by=False)
    print(df)
    print("***********************************************")
    print(arr)
コード例 #4
0
def main():
    df = sample_data1()
    df["month"] = pd.to_datetime(df["times"]).dt.to_period("M")
    arr = make_recurrent(
        df,
        3,
        "times",
        partition_by="month",
        drop_order_by=False,
        drop_partition_by=False,
    )
    print(df)
    print("***********************************************")
    print(arr)
    print(f"Output shape is {arr.shape}")