I have the following pandas structure:
col1 col2 col3 text
1 1 0 meaningful text
5 9 7 trees
7 8 2 text
I\'d lik
I would like to add some information to the accepted answer.
Before concatenating the two DataFrames (i.e. main DataFrame and TF-IDF DataFrame), make sure that the indices between the two DataFrames are similar. For instance, you can use df.reset_index(drop=True, inplace=True) to reset the DataFrame index.
Otherwise, your concatenated DataFrames will contain a lot of NaN rows. Having looked at the comments, this is probably what the OP experienced.