0

I'm dealing with almost 7000 strings and when I vectorize it correctly the output shown the head and the tail of the output

tfidf_transformer = TfidfTransformer().fit(tweet_bagow)
tweet_tfidf = tfidf_transformer.transform(tweet_bagow)
print(tweet_tfidf)

the output is

  (1, 18924)    0.23289785588568357
  (1, 17728)    0.23289785588568357
  (1, 17324)    0.1810217418686322
  (1, 16354)    0.096940817964108
  (1, 15383)    0.22245866652336163
  : :
  (6239, 15381) 0.25658814474406894
  (6239, 13588) 0.28550824143706277
  (6239, 9784)  0.28550824143706277
  (6239, 8280)  0.28550824143706277
  (6239, 6696)  0.22191358948429074

how can I print the full output without this ( : : ) thing in the middle?

Ali Yousef
  • 35
  • 6

1 Answers1

1

From the documentation one has:

"To disable this behaviour and force NumPy to print the entire array, you can change the printing options using:"

import numpy as np
np.set_printoptions(threshold='nan')
gented
  • 1,620
  • 1
  • 16
  • 20
  • I'm not using NumPy on my code, I tried it it is not working. Or you can tell me how to implement this and correct me if I'm wrong – Ali Yousef Feb 23 '18 at 23:31
  • `scikit` uses `numpy`, so you *are* using it, if indirectly. – Scott Hunter Feb 24 '18 at 00:48
  • but the output of the code is not an array, so it doesn't work. – Ali Yousef Feb 24 '18 at 02:05
  • @AliYousef then you should operate the options of the type you are getting: if it is a `pandas` dataframe there are corresponding options, if it is a matrix likewise, and so on. As such, first check the type you're outputting and then check the corresponding options for display. – gented Feb 24 '18 at 11:47
  • @gented this is the type of `tfidf` : ` ` – Ali Yousef Feb 26 '18 at 06:43