I have a matrix obtained with pandas.dataframe in this way:
tfidf = TfidfVectorizer()
x = tfidf.fit_transform(corpus)
df_tfidf = pd.DataFrame(x.toarray(),columns=tfidf.get_feature_names())
It seems like the matrix below:
My matrix has more columns and more rows. It has 7180 rows and 10390 columns. Is there a way to print the header of col and its value is this value is greater than 0 ? somethink like this and: 0.511859, document: 0.46,0.68 ..
I tried in this way but it take a lot of time:
for col in df_tfidf.columns:
for row in df_tfidf.index:
if df_tfidf[col][row] > 0:
print str(df_tfidf[col][row]) + ' ' + col.encode('utf8')
Is there a way to do this faster ?

tfidfvalues you mean positive values for each column, right? And do you need to store this values maybe in some dictionary or just wants to print them?word: value. I'm tring to work on the answer given by chris