成功解决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]