python scikit-learn TfidfVectorizer: why ValueError when input is 2 single-character strings?
Question: I am trying to run something like this:

    
    
    from sklearn.feature_extraction.text import TfidfVectorizer
    
    test_text = ["q", "r"]
    
    vect = TfidfVectorizer(min_df=1,
                           stop_words=None, 
                           lowercase=False) 
    tfidf = vect.fit_transform(test_text)
    
    print vect.get_feature_names()
    

But get a ValueError:

`ValueError: empty vocabulary; perhaps the documents only contain stop words`

Does guidance exist on what limitations or constraints for the input are? I
was not able to find anything on the [TfidfVectorizer doc page](http://scikit-
learn.org/stable/modules/generated/sklearn.feature_extraction.text.TfidfVectorizer.html).
I tried to trace it, and got to the `_count_vocab` function, but I have
trouble reading it. Also, when I change the strings to length 2 or more, code
runs fine.


Answer: The error is because of the min_df parameter. When you set the value of min_df
=0, it will work fine as it will not be bounded by the 'minimum threshold'
which is currently set to 1 and each of your word also appears for once only.

