@@ -103,6 +103,10 @@ def analyze_contributions_vs_score():
103103 view_of_interest_first = (
104104 df [
105105 (df ["first_appearance" ] < 2024 ) #& (~df["last_appearance"].isin([2023, 2024]))
106+ # ~(
107+ # (df["first_appearance"] == 2023) & (df["last_appearance"] == 2023)
108+ # ) # .any( axis=1)
109+ # & (df["last_appearance"] < 2024)
106110 ] # Remove this year and last year, in order no to mix the findings.
107111 .groupby ("first_appearance" )
108112 .agg ({"author_name" : "count" })
@@ -114,6 +118,7 @@ def analyze_contributions_vs_score():
114118 view_of_interest = view_of_interest_first .merge (
115119 view_of_interest_last ,
116120 how = "outer" ,
121+ # how="inner",
117122 left_on = "first_appearance" ,
118123 right_on = "last_appearance" ,
119124 suffixes = ("_first" , "_last" ),
@@ -140,7 +145,7 @@ def analyze_contributions_vs_score():
140145 fig .update_layout (font = font_settings )
141146 # Show all the xticks
142147 fig .update_xaxes (tickmode = "linear" )
143-
148+
144149 # Rename the y-axis legends
145150 newnames = {
146151 "new_users" : "First-seen users" ,
@@ -246,7 +251,7 @@ def analyze_contributions_vs_score():
246251 # Center the title
247252 fig .update_layout (title_x = 0.5 )
248253 fig .update_layout (font = font_settings )
249- # fig.show()
254+ fig .show ()
250255 # Save the figure
251256 fig .write_image ("nb_of_stories_vs_author_total_score.png" )
252257
@@ -571,7 +576,7 @@ def analyze_contributions_vs_score_v2():
571576 df = AnyQueries (
572577 fresh = False ,
573578 query_name = "contributions_vs_karma_vs_score" ,
574- # fresh=True , query_name="comments_per_year"
579+ # fresh=False , query_name="comments_per_year"
575580 ).get_df ()
576581 print (f"Time to get the data: { time .time () - time_start :.2f} seconds" )
577582 print (df .shape )
@@ -601,7 +606,7 @@ def analyze_contributions_vs_score_v2():
601606 # Center the title
602607 fig .update_layout (title_x = 0.5 )
603608 fig .update_layout (font = font_settings )
604- # fig.show()
609+ fig .show ()
605610 # Save the figure
606611 fig .write_image ("author_karma_vs_nb_of_stories.png" )
607612
@@ -709,7 +714,7 @@ def main():
709714 analyze_contributions_vs_score ()
710715 analyze_type_per_time ()
711716 analyze_commentators_behavior ()
712- # analyze_contributions_vs_score_v2()
717+ analyze_contributions_vs_score_v2 ()
713718
714719if __name__ == "__main__" :
715720 main ()
0 commit comments