feature_engineering.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:copper_price_forecast 作者: liyinwei 项目源码 文件源码
def _pp_min_max_scale(df):
    """
    ????????
    """
    print("  start minmax scaling...")
    # drop?id?price_date??
    # df = df.drop(['id', 'price_date'], axis=1)
    # ??index???column??
    index = df.index
    columns = df.columns
    # ????????
    feature_scaled = preprocessing.MinMaxScaler().fit_transform(df.iloc[:, :-1])

    target = np.array(df.iloc[:, -1])
    target.shape = (len(target), 1)

    # ???????X???????y?????Pandas ? DataFrame??????numpy?ndarray???
    df_scaled = pd.DataFrame(np.hstack((feature_scaled, target)))
    # ???????column??
    df_scaled.index = index
    df_scaled.columns = columns

    print("  minmax scaling finished.")
    return df_scaled
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号