成功解决xgboost\core.py", ValueError: feature_names may not contain [, ] or <

简介: 成功解决xgboost\core.py", ValueError: feature_names may not contain [, ] or <

解决问题


xgboost\core.py", line 869, in feature_names

   raise ValueError('feature_names may not contain [, ] or <')

ValueError: feature_names may not contain [, ] or <




解决思路


错误地址:xgboost\core.py", line 869,

值错误:feature_names中不能包含[,]或<的符号




解决方法

'添加以下三行解决问题'

import re

regex = re.compile(r"\[|\]|<", re.IGNORECASE)

boston_train.columns = [regex.sub("_", col) if any(x in str(col) for x in set(('[', ']', '<'))) else col for col in boston_train.columns.values]



相关文章
|
3月前
|
TensorFlow 算法框架/工具 Python
【Tensorflow】解决Tensorboard: ValueError: Duplicate plugins for name projector
解决TensorBoard版本冲突的方法,即通过卸载冲突的TensorFlow相关包然后重新安装所需的版本。
109 1
|
4月前
|
机器学习/深度学习 数据处理 Python
【Python】已解决:FutureWarning: Function get_feature_names is deprecated; get_feature_names is deprecated
【Python】已解决:FutureWarning: Function get_feature_names is deprecated; get_feature_names is deprecated
51 0
|
4月前
|
API Python
【Python】已解决:AttributeError: ‘TfidfVectorizer’ object has no attribute ‘get_feature_names_out’
【Python】已解决:AttributeError: ‘TfidfVectorizer’ object has no attribute ‘get_feature_names_out’
89 0
|
TensorFlow 算法框架/工具
TF版本升级问题:成功解决AttributeError: module tensorflow has no attribute mul
TF版本升级问题:成功解决AttributeError: module tensorflow has no attribute mul
TF版本升级问题:成功解决AttributeError: module tensorflow has no attribute mul
成功解决_catboost.CatBoostError: Invalid cat_features[4] = 8 value: index must be < 8.
成功解决_catboost.CatBoostError: Invalid cat_features[4] = 8 value: index must be < 8.
【yolov5报错】Can‘t get attribute ‘SPPF‘ on <module ‘models.common‘ from ‘--yolov5-5.0\models\common.py
【yolov5报错】Can‘t get attribute ‘SPPF‘ on <module ‘models.common‘ from ‘--yolov5-5.0\models\common.py
1119 0
成功解决xgboost\core.py:614: UserWarning: Use subset (sliced data) of np.ndarray is not recommended beca
成功解决xgboost\core.py:614: UserWarning: Use subset (sliced data) of np.ndarray is not recommended beca
成功解决sklearn\ensemble\weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an interna
成功解决sklearn\ensemble\weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an interna
|
计算机视觉
成功解决sklearn\cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 i
成功解决sklearn\cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 i
|
TensorFlow 算法框架/工具
成功解决AttributeError: module 'tensorflow.python.training.training' has no attribute 'SummaryWriter'
成功解决AttributeError: module 'tensorflow.python.training.training' has no attribute 'SummaryWriter'