question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SimpleImputer should support String type

See original GitHub issue

Hi,

I’m getting this error:

RuntimeError: Operator SklearnSimpleImputer (type: SklearnSimpleImputer) got an input merged_columns with a wrong type <class 'onnxconverter_common.data_types.StringTensorType'>. Only [<class 'onnxconverter_common.data_types.FloatTensorType'>, <class 'onnxconverter_common.data_types.Int64TensorType'>, <class 'onnxconverter_common.data_types.DoubleTensorType'>] are allowed

But when using the option strategy="most_frequent" or strategy="constant", it supports strings, see https://scikit-learn.org/stable/modules/generated/sklearn.impute.SimpleImputer.html.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
gs-altcommented, Nov 4, 2021

I get the same error as @victornoel

1reaction
victornoelcommented, Oct 21, 2021

Hey @xadupre, it has been some time, and there is still one thing that does not work: when I use None as the value for missing_values:

SimpleImputer(missing_values=None, strategy='most_frequent')

I get this error:

NotImplementedError: The converter is implemented when the missing values are string not <class 'NoneType'>.
Read more comments on GitHub >

github_iconTop Results From Across the Web

sklearn.impute.SimpleImputer
Can be used with strings or numeric data. If there is more than one such value, only the smallest is returned. If “constant”,...
Read more >
Sklearn SimpleImputer Example - Impute Missing Data
SimpleImputer is a class in the sklearn.impute module that can be used to ... but can also handle categorical data represented as strings....
Read more >
' not supported between instances of 'str' and 'int' - Stack ...
When I try to gather object class items to impute them, it throws this error. TypeError: '<' not supported between instances of 'str'...
Read more >
sklearn SimpleImputer too slow for categorical data ...
I have a data set with categorical features represented as string values and I want to fill-in missing values in it. I've tried...
Read more >
How to use the SimpleImputer Class in Machine Learning with ...
Datasets often have missing values and this can cause problems for machine learning algorithms. It is considered good practise to identify ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found