Issue 1:
Describe the bug

[sklearn/feature_extraction/text.py]n _preprocess(doc, accent_function, lower)
69 """
70 if lower:
---> 71 doc = doc.lower()
72 if accent_function is not None:
73 doc = accent_function(doc)

AttributeError: 'list' object has no attribute 'lower'

Steps/Code to Reproduce

def cosine_similarity_T(k, query):
print("1")
preprocessed_query = re.sub("\W+", " ", query).strip()
print("2")
tokens = word_tokenize(str(preprocessed_query))
q_df = pd.DataFrame(columns=['q_clean'])
q_df.loc[0,'q_clean'] =tokens
q_df['q_clean'] =q_df['q_clean'].apply(lambda x: remove_stopwords(x))
d_cosines = []
print("3")
query_vector = gen_vector_T(q_df['q_clean'])

for d in vectors.A:
d_cosines.append(cosine_sim(query_vector, d))

out = np.array(d_cosines).argsort()[-k:][::-1]
#print("")
d_cosines.sort()
a = pd.DataFrame()
for i,index in enumerate(out):
a.loc[i,'index'] = str(index)
a.loc[i,'Subject'] = df['Subject'][index]
for j,simScore in enumerate(d_cosines[-k:][::-1]):
a.loc[j,'Score'] = simScore
return

Expected Results

ist gets converted to lowercase as well

Actual Results

only string gets converted to lowecase

Versions

wish we could have that functionality to convert a list to lowercase too as we do for a string

Issue 2:
I wonder if we should allow (n_samples, 1) input to CountVectorizer. I think we had this discussion before, right now we basically have a special case in ColumnTransformer with scalar columns to produce 1d arrays.

Does anyone remember where this discussion was?

A lot of my students are struggling with putting a CountVectorizer into a ColumnTransformer and it might be nice to be more generous with the input formats, and ensure we raise nice error messages.

import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
X = pd.DataFrame(["what is my purpose?", "You bring the butter."])
CountVectorizer().fit_transform(X)

---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-6-6cae33e8c706> in <module>
3 from sklearn.compose import ColumnTransformer
4 X = pd.DataFrame(["what is my purpose?", "You bring the butter."])
----> 5 CountVectorizer().fit_transform(X)

~/miniconda3/lib/python3.7/site-packages/sklearn/feature_extraction/text.py in fit_transform(self, raw_documents, y)
1218
1219 vocabulary, X = self._count_vocab(raw_documents,
-> 1220 self.fixed_vocabulary_)
1221
1222 if self.binary:

~/miniconda3/lib/python3.7/site-packages/sklearn/feature_extraction/text.py in _count_vocab(self, raw_documents, fixed_vocab)
1129 for doc in raw_documents:
1130 feature_counter = {}
-> 1131 for feature in analyze(doc):
1132 try:
1133 feature_idx = vocabulary[feature]

~/miniconda3/lib/python3.7/site-packages/sklearn/feature_extraction/text.py in _analyze(doc, analyzer, tokenizer, ngrams, preprocessor, decoder, stop_words)
101 else:
102 if preprocessor is not None:
--> 103 doc = preprocessor(doc)
104 if tokenizer is not None:
105 doc = tokenizer(doc)

~/miniconda3/lib/python3.7/site-packages/sklearn/feature_extraction/text.py in _preprocess(doc, accent_function, lower)
66 """
67 if lower:
---> 68 doc = doc.lower()
69 if accent_function is not None:
70 doc = accent_function(doc)

AttributeError: 'int' object has no attribute 'lower'