X-Git-Url: https://code.communitydata.science/cdsc_reddit.git/blobdiff_plain/b4dd9acbd8e499d87714413b8260240341ebf7d7..65deba5e4e4ad9e3f23e82573491f7d6b190e644:/similarities/top_subreddits_by_comments.py diff --git a/similarities/top_subreddits_by_comments.py b/similarities/top_subreddits_by_comments.py index 1197b51..ff9293c 100644 --- a/similarities/top_subreddits_by_comments.py +++ b/similarities/top_subreddits_by_comments.py @@ -17,7 +17,7 @@ df = df.filter(~df.subreddit.like("u_%")) df = df.groupBy('subreddit').agg(f.count('id').alias("n_comments")) df = df.join(prop_nsfw,on='subreddit') -df = df.filter(df.prop_nsfw < 0.5) +#df = df.filter(df.prop_nsfw < 0.5) win = Window.orderBy(f.col('n_comments').desc()) df = df.withColumn('comments_rank', f.rank().over(win)) @@ -26,4 +26,4 @@ df = df.toPandas() df = df.sort_values("n_comments") -df.to_csv('/gscratch/comdata/output/reddit_similarity/subreddits_by_num_comments.csv', index=False) +df.to_csv('/gscratch/comdata/output/reddit_similarity/subreddits_by_num_comments_nsfw.csv', index=False)