1
$\begingroup$

I tried to make the bag of words

pattern = re.compile('[^A-Za-z0-9]+' '' " $#! People Whitespace")
df["bag_of_words"]= df["bag_of_words"].apply(lambda s: ''.join([i for i in str(s) if not pattern.findall(i)]))

and apply fit transform and check the feature names

feature_names = count.get_feature_names()

but it includes some (Dr.)strange characters looks like following

['', '_', '____', '_____', '______', '_______', '__________', '_____________', '__________cat', '__________something', '_________soso, '_________dog']


what is this ______ thing? and how to remove it?

$\endgroup$
  • $\begingroup$ You might try posting on StackOverflow where there are more developers. You may also improve your question by sharing what your df looks like as well as which transform(s) you are applying $\endgroup$ – MichaelD Jul 24 at 5:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.