【问题记录】utureWarning: Function get_feature_names is deprecated; get_feature_names is deprecated in 1.0

简介: 【问题记录】utureWarning: Function get_feature_names is deprecated; get_feature_names is deprecated in 1.0

问题记录



这里的代码报了警告:


# 打印属性名称
print(vec.get_feature_names())


在PyCharm中遇到如下问题:

D:\Anaconda3\lib\site-packages\sklearn\utils\deprecation.py:87:


FutureWarning: Function get_feature_names is deprecated; get_feature_names is deprecated in 1.0 and will be 
removed in 1.2. Please use get_feature_names_out instead.
  warnings.warn(msg, category=FutureWarning)


翻译一下是这样:

FutureWarning:函数 get_feature_names 已弃用; get_feature_names 在 1.0 中已弃用,并将在 1.2 中删除。 请改用 get_feature_names_out


warnings.warn(味精,类别=FutureWarning)

简单来说,就是上面在PyCharm中使用的方法,在当前版本中已经不使用了,改用另一个了,那么将代码改成下面即可:


# # 打印属性名称
print(vec.get_feature_names_out())

这样就符合当前版本,不报警告了 ~

相关文章
|
12月前
Multiple substitutions specified in non-positional format; did you mean to add BUG(7)
Multiple substitutions specified in non-positional format; did you mean to add BUG(7)
解决AttributeError: ‘Namespace‘ object has no attribute ‘arch‘
解决AttributeError: ‘Namespace‘ object has no attribute ‘arch‘
661 0
Duplicate methods named spliterator with the parameters () and () are inherited from the types Colle
Duplicate methods named spliterator with the parameters () and () are inherited from the types Colle
50 0
解决办法:error: ‘unordered_map’ in namespace ‘std’ does not name a template type
解决办法:error: ‘unordered_map’ in namespace ‘std’ does not name a template type
419 0
成功解决KeyError: “Passing list-likes to .loc or [] with any missing labels is no longer supported. The
成功解决KeyError: “Passing list-likes to .loc or [] with any missing labels is no longer supported. The
|
TensorFlow 算法框架/工具
成功解决To fix this you could try to: 1. loosen the range of package versions you‘ve specified ​​​​​​​
成功解决To fix this you could try to: 1. loosen the range of package versions you‘ve specified ​​​​​​​
成功解决To fix this you could try to: 1. loosen the range of package versions you‘ve specified ​​​​​​​
Changing scope values asynchronously - updates don't propagate without .apply()
Changing scope values asynchronously - updates don't propagate without .apply()
Changing scope values asynchronously - updates don't propagate without .apply()
Changing scope values asynchronously - updates don't propagate without .apply()
Changing scope values asynchronously - updates don't propagate without .apply()
Changing scope values asynchronously - updates don't propagate without .apply()
成功解决 ValueError: feature_names mismatch training data did not have the following fields
成功解决 ValueError: feature_names mismatch training data did not have the following fields