so my question is based on this question.
I have Twitter data where I extracted unigram features and number of orthographies features such as excalamation mark, question mark, uppercase, and lowercase. I want to stack orthographies features into transformed unigram feature. Here is my code:
X_train, X_test, y_train, y_test = train_test_split(tweet_df[['tweets', 'exclamation', 'question', 'uppercase', 'lowercase']], tweet_df['class'], stratify=tweet_df['class'],
test_size = 0.2, random_state=0)
count_vect = CountVectorizer(ngram_range=(1,1))
X_train_gram = count_vect.fit_transform(X_train['tweets'])
tfidf = TfidfTransformer()
X_train_gram = tfidf.fit_transform(X_train_gram)
X_train_gram = hstack((X_train_gram,np.array(X_train['exclamation'])[:,None]))
This worked, however I can't find a way to incorporate the rest of columns (question, uppercase, lowercase) into the stack in one line of code. Here is the failed try:
X_train_gram = hstack((X_train_gram,np.array(list(X_train['exclamation'], X_train['question'], X_train['uppercase'], X_train['lowercase']))[:,None])) #list expected at most 1 arguments, got 4
X_train_gram = hstack((X_train_gram,np.array(X_train[['exclamation', 'question', 'uppercase', 'lowercase']])[:,None])) #expected dimension <= 2 array or matrix
X_train_gram = hstack((X_train_gram,np.array(X_train[['exclamation', 'question', 'uppercase', 'lowercase']].values)[:,None])) #expected dimension <= 2 array or matrix
Any help appreciated.