I am new to Python and Data Science in general. I am trying to work on some LDA visualizations, but for some reason I keep getting the following error. Any help would be greatly appreciated!
Type Error: an integer is required (got type str)
import os
LDAvis_data_filepath = os.path.join('./ldavis_prepared_'+str(number_topics))
# # this is a bit time consuming - make the if statement True
# # if you want to execute visualization prep yourself
if 1 == 1:
LDAvis_prepared = sklearn_lda.prepare(lda, count_data, count_vectorizer)
with open(LDAvis_data_filepath, 'wb', 'utf-8') as f:
pickle.dump(LDAvis_prepared, f)
#load the pre-prepared pyLDAvis data from disk
with open(LDAvis_data_filepath,'rb', 'utf-8') as f:
pickle.dump(LDAvis_prepared, f)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-110-4459335c1578> in <module>
----> 1 with open(LDAvis_data_filepath, 'wb', 'utf-8') as f:
2 pickle.dump(LDAvis_prepared, f)
3 # load the pre-prepared pyLDAvis data from disk
4 with open(LDAvis_data_filepath,'rb', 'utf-8') as f:
5 pickle.dump(LDAvis_prepared, f)
TypeError: an integer is required (got type str)