89b43bbd55550d5c103a8b06281d9bc62e533680,QUANTAXIS/QAData/data_resample.py,,QA_data_min_resample,#Any#Any#,348

Before Change


    

    try:
        min_data = min_data.reset_index().set_index("datetime", drop=False)
    except:
        min_data = min_data.set_index("datetime", drop=False)

    CONVERSION = {
        "code": "first",
        "open": "first",
        "high": "max",
        "low": "min",
        "close": "last",
        "vol": "sum",
        "amount": "sum"
    } if "vol" in min_data.columns else {
        "code": "first",
        "open": "first",
        "high": "max",
        "low": "min",
        "close": "last",
        "volume": "sum",
        "amount": "sum"
    }
    resx = pd.DataFrame()

    for item in set(min_data.index.date):
        min_data_p = min_data.loc[str(item)]
        n = min_data_p["{} 21:00:00".format(item):].resample(
            type_,
            base=30,
            closed="right",
            loffset=type_
        ).apply(CONVERSION)

        d = min_data_p[:"{} 11:30:00".format(item)].resample(
            type_,
            base=30,
            closed="right",
            loffset=type_
        ).apply(CONVERSION)
        f = min_data_p["{} 13:00:00".format(item):].resample(
            type_,
            closed="right",
            loffset=type_
        ).apply(CONVERSION)

        resx = resx.append(d).append(f)

    return resx.dropna().reset_index().set_index(["datetime", "code"])


def QA_data_min_resample_stock(min_data, period=5):

After Change


        loffset=type_
    ).apply(CONVERSION)
    part_2 = min_data.iloc[idx.indexer_between_time("13:00", "15:00")]
    part_2_res = part_2.resample(
        type_,
        base=0,
        closed="right",
        loffset=type_
    ).agg(CONVERSION)
    return pd.concat([part_1_res, part_2_res]).dropna().sort_index().reset_index().set_index(["datetime", "code"])


Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: QUANTAXIS/QUANTAXIS
Commit Name: 89b43bbd55550d5c103a8b06281d9bc62e533680
Time: 2019-08-05
Author: yutiansut@qq.com
File Name: QUANTAXIS/QAData/data_resample.py
Class Name:
Method Name: QA_data_min_resample


Project Name: bashtage/linearmodels
Commit Name: a0be73979eded2a2cea2fd526ea5db87b1abf3c5
Time: 2020-01-20
Author: kevin.k.sheppard@gmail.com
File Name: linearmodels/system/results.py
Class Name: SystemResults
Method Name: _out_of_sample


Project Name: commonsense/conceptnet5
Commit Name: 79928872e7b2118ae0cbc8f818850473e15fe14f
Time: 2017-03-30
Author: rob@luminoso.com
File Name: conceptnet5/vectors/debias.py
Class Name:
Method Name: get_vocabulary_vectors