您当前的位置: 首页 > 
  • 0浏览

    0关注

    2393博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

成功解决ValueError: cannot reindex from a duplicate axis

一个处女座的程序猿 发布时间:2022-08-18 22:01:37 ,浏览量:0

成功解决ValueError: cannot reindex from a duplicate axis

目录

解决问题

解决思路

解决方法

解决问题

ValueError: cannot reindex from a duplicate axis

解决思路
def target_plot_interact(df, features, feature_names, target, num_grid_points=None, 
 grid_types=None, 
    percentile_ranges=None, grid_ranges=None, cust_grid_points=None, 
     show_percentile=False, 
    show_outliers=False, endpoint=True, figsize=None, ncols=2, annotate=False, 
     plot_params=None):
    """Plot average target value across different feature value combinations (feature grid 
     combinations)
    
    Parameters
    ----------
    
    df: pandas DataFrame
    data set to investigate on, should contain at least
    the feature to investigate as well as the target
    features: list
    two features to investigate

值错误:不能从重复的轴重新索引

解决方法

features: list,two features to investigate,经过分析,features是需要指定两个不同的特征,即x和y,而且x=y,之所以,出现上述错误,是因为定义的两个特征完全一致,导致不满足该函数方法!所之需要将其中一个特征名改为另一个即可!

features=[num_col2plot,num_col2plot02]

关注
打赏
1664196048
查看更多评论
立即登录/注册

微信扫码登录

0.0420s