# 这个区别方式适用于没有直接label coding的数据,意思是没有人为都转变为 数字的特征 # 这里不适用,需要人为根据实际含义来区分,意思 是需要自己挑选出那一些 类型特征 # 数字特征 numeric_features = Test_data.select_dtypes(include=[np.number]) print("数字特征:", numeric_features.columns) # 类型特征 categorical_features = Test_data.select_dtypes(include=[np.object]) print("类型特征:", categorical_features.columns)raise AttributeError(__former_attrs__[attr]) AttributeError: module 'numpy' has no attribute 'object'. `np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:;Did you mean: 'object_'?
时间: 2024-03-10 12:48:34 浏览: 307
zxymax#coding#CSS引入方式1
这个错误提示是因为在numpy库中,np.object已经被弃用了,应该使用object来代替。你可以将代码中的np.object替换为object就可以解决这个错误了。具体来说,你可以将代码修改为下面这样:
```
# 数字特征
numeric_features = Test_data.select_dtypes(include=[np.number])
print("数字特征:", numeric_features.columns)
# 类型特征
categorical_features = Test_data.select_dtypes(include=[object])
print("类型特征:", categorical_features.columns)
```
这样就不会再出现这个错误了。
阅读全文