]> code.communitydata.science - cdsc_reddit.git/blobdiff - similarities/tfidf.py
Use Latent semantic indexing and hdbscan
[cdsc_reddit.git] / similarities / tfidf.py
index 30033a829dc1e563b1267f817d92378414f0c9d1..002e89f785b37fd9df3c903775ab6f71846909d4 100644 (file)
@@ -15,10 +15,9 @@ def _tfidf_wrapper(func, inpath, outpath, topN, term_colname, exclude, included_
     else:
         include_subs = select_topN_subreddits(topN)
 
     else:
         include_subs = select_topN_subreddits(topN)
 
-    df = func(df, include_subs, term_colname)
-
-    df.write.parquet(outpath,mode='overwrite',compression='snappy')
+    dfwriter = func(df, include_subs, term_colname)
 
 
+    dfwriter.parquet(outpath,mode='overwrite',compression='snappy')
     spark.stop()
 
 def tfidf(inpath, outpath, topN, term_colname, exclude, included_subreddits):
     spark.stop()
 
 def tfidf(inpath, outpath, topN, term_colname, exclude, included_subreddits):

Community Data Science Collective || Want to submit a patch?