# fit transform with mysterious special chracters

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?

• 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 – MichaelD Jul 24 '19 at 5:03