小编NgB*_*don的帖子

如何删除Countvectorizer中存在的数字字符?

如何消除进入 countvectorizer 我的代码的数字字符

cv = CountVectorizer(min_df=50, stop_words='english',max_features = 5000,analyzer='word') 


    cv_fit_addr=cv.fit_transform(data['Adj_Addr'])



 print(cv.get_feature_names())

['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '100', '1001', '1002', '1003', '1004', '1005', '1008', '101', '1010', '102', '103', '104', '105', '106', '107', '108', '109', '10f', '10th', '11', '1101', '1102', '1103', '1104', '1105', '1106', '1108', '111', '1111', '113', '114', '116', '118', '11f', '11th', '12', '120', '1201', '1202', '1203', '1204', '1206', '1208', '121', '122', '123', '125', '126', '128', '12a', '12f', '12th', '13', '1301', '1302', '1303', '1305', '1308', '132', …
Run Code Online (Sandbox Code Playgroud)

python nltk pandas scikit-learn

6
推荐指数
3
解决办法
4088
查看次数

反向标签编码给出错误

我使用标签编码器将我的分类数据标记为数字数据

data['Resi'] = LabelEncoder().fit_transform(data['Resi'])
Run Code Online (Sandbox Code Playgroud)

但是当我试图找到它们如何在内部使用时

list(LabelEncoder.inverse_transform(data['Resi']))
Run Code Online (Sandbox Code Playgroud)

我得到以下错误


TypeError                                 Traceback (most recent call last)
<ipython-input-67-419ab6db89e2> in <module>()
----> 1 list(LabelEncoder.inverse_transform(data['Resi']))

TypeError: inverse_transform() missing 1 required positional argument: 'y'
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题

样本数据

Resi
IP
IP
IP
IP
IP
IE
IP
IP
IP
IP
IP
IPD
IE
IE
IP
IE
IP
IP
IP
Run Code Online (Sandbox Code Playgroud)

python numpy pandas scikit-learn sklearn-pandas

4
推荐指数
1
解决办法
7042
查看次数

标签 统计

pandas ×2

python ×2

scikit-learn ×2

nltk ×1

numpy ×1

sklearn-pandas ×1