Skip to content

多列或多重索引的情况时,存在值没有按列名对应,造成错误结果 #26

@RayLam2022

Description

@RayLam2022

在def ipfn_df中的变量tmp 如遇到pd.MultiIndex的情况时,当.groupby(features)[weight_col].sum()存在多重索引时(即for features in dimensions:中的len(features)>1时),level0和level1索引会重新按默认值排序,同时部分索引用了loc定位,部分可能只按默认值顺序,导致结果可能会与原设定对应错误,造成错误的结果,如果不优化代码,使用def ipfn_df需要注意df的列名顺序

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions