Py3上的调试问题 AttributeError: module 'types' has no attribute 'ListType'求解
2017-12-06 21:46
671 查看
import types as Types
def TrainCART(df,feature_list,y, depth = 10000):
'''
:param df: 建立CART的数据集
:param feature_list: 用于模型开发的特征的列表
:param y: 标签,取值0,1
:param depth: 树的深度。当指明深度时,设置该参数。
:return: 叶子节点,或者子树。最终返回字典形式的CART树
'''
cartResult = {bestFeature:{}}
if type(bestSplit) == Types.ListType: #按:出错,==types.ListType;试着改为Types.ListType
#AttributeError: module 'types' has no attribute 'ListType'
subTreeFeatures = [i for i in feature_list if i != bestFeature]
bestFeaturesVals = list(set(df[bestFeature]))
def TrainCART(df,feature_list,y, depth = 10000):
'''
:param df: 建立CART的数据集
:param feature_list: 用于模型开发的特征的列表
:param y: 标签,取值0,1
:param depth: 树的深度。当指明深度时,设置该参数。
:return: 叶子节点,或者子树。最终返回字典形式的CART树
'''
cartResult = {bestFeature:{}}
if type(bestSplit) == Types.ListType: #按:出错,==types.ListType;试着改为Types.ListType
#AttributeError: module 'types' has no attribute 'ListType'
subTreeFeatures = [i for i in feature_list if i != bestFeature]
bestFeaturesVals = list(set(df[bestFeature]))
相关文章推荐
- 【TensorFlow问题】AttributeError:'module' object has no attribute 'mul'
- 使用旧版本tensorflow出现了negative等报错的问题,AttributeError: 'module' object has no attribute 'xxx'"
- AttributeError: ‘module’ object has no attribute’xxx 问题解决
- 【TensorFlow问题】AttributeError:'module' object has no attribute 'mul'
- TF版本问题:解决AttributeError: module 'tensorflow' has no attribute 'mul'—Jason niu
- AttributeError: 'module' object has no attribute 'face' 问题解决 opencv+python
- 【TensorFlow问题】AttributeError:'module' object has no attribute 'mul'
- Tensorflow出现AttributeError: module 'tensorflow' has no attribute 'constant'问题怎么办?
- AttributeError: ‘module’ object has no attribute’ 问题
- 解决问题 AttributeError: 'module' object has no attribute 'face_recognition_model_v1'
- AttributeError: 'module' object has no attribute 'post'问题
- AttributeError: module 'tensorflow' has no attribute 'sub'
- 'module' object has no attribute 'MLPRegressor'问题解决(Python2.7)
- AttributeError: module 'sys' has no attribute 'setdefaultencoding'
- AttributeError: 'module' object has no attribute 'text_format'
- AttributeError: module 'urllib' has no attribute 'urlopen'
- AttributeError: 'module' object has no attribute '_base' 可行解决办法
- AttributeError: 'module' object has no attribute 的解决方法
- Scrapy AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1 解决方法
- AttributeError: 'module' object has no attribute 'getpass'