1 Reply Latest reply on Aug 21, 2018 1:47 PM by Prithvi Shetty

    How do I display Python print output statements on Tableau dashboard using TabPy?

    Prithvi Shetty



      I was working with the TabPy interface to display my python code output onto Tableau.


      I wrote a Python function which will reduce the themes from the given sentences using NLP. It works perfectly fine in my Jupyter notebook. But when I try executing the same in Tableau, it shows the error : " No return value."


      This is my function which needs to be executed :


      "def display_topics2(model, feature_names, documents, no_top_words, no_top_documents,countv=tfidf):

          for topic_idx, topic in enumerate(model.components_):

              print ('\033[1m' + 'Topic %d:' % (topic_idx) + '\033[0;0m')

              print ('\033[1m' + ' '.join([feature_names[i]

                              for i in topic.argsort()[:-no_top_words - 1:-1]]) +  '\033[0;0m')

              print(' ')

              top_doc_indices = np.argsort(model.transform(countv)[:,topic_idx] )[::-1][0:no_top_documents]

              for doc_index in top_doc_indices:

                  print (documents[doc_index])

                  print (' ')



      display_topics2(nmf, tfidf_feature_names, documents, no_top_words, no_top_documents,tfidf)






      ATTR([Comment Text])





      Can you please help me out on how to just simply display the print statements output on Tableau? Appending on lists won't work either.


      Thank you,