@@ -103,6 +103,10 @@ def analyze_contributions_vs_score():
103
103
view_of_interest_first = (
104
104
df [
105
105
(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)
106
110
] # Remove this year and last year, in order no to mix the findings.
107
111
.groupby ("first_appearance" )
108
112
.agg ({"author_name" : "count" })
@@ -114,6 +118,7 @@ def analyze_contributions_vs_score():
114
118
view_of_interest = view_of_interest_first .merge (
115
119
view_of_interest_last ,
116
120
how = "outer" ,
121
+ # how="inner",
117
122
left_on = "first_appearance" ,
118
123
right_on = "last_appearance" ,
119
124
suffixes = ("_first" , "_last" ),
@@ -140,7 +145,7 @@ def analyze_contributions_vs_score():
140
145
fig .update_layout (font = font_settings )
141
146
# Show all the xticks
142
147
fig .update_xaxes (tickmode = "linear" )
143
-
148
+
144
149
# Rename the y-axis legends
145
150
newnames = {
146
151
"new_users" : "First-seen users" ,
@@ -246,7 +251,7 @@ def analyze_contributions_vs_score():
246
251
# Center the title
247
252
fig .update_layout (title_x = 0.5 )
248
253
fig .update_layout (font = font_settings )
249
- # fig.show()
254
+ fig .show ()
250
255
# Save the figure
251
256
fig .write_image ("nb_of_stories_vs_author_total_score.png" )
252
257
@@ -571,7 +576,7 @@ def analyze_contributions_vs_score_v2():
571
576
df = AnyQueries (
572
577
fresh = False ,
573
578
query_name = "contributions_vs_karma_vs_score" ,
574
- # fresh=True , query_name="comments_per_year"
579
+ # fresh=False , query_name="comments_per_year"
575
580
).get_df ()
576
581
print (f"Time to get the data: { time .time () - time_start :.2f} seconds" )
577
582
print (df .shape )
@@ -601,7 +606,7 @@ def analyze_contributions_vs_score_v2():
601
606
# Center the title
602
607
fig .update_layout (title_x = 0.5 )
603
608
fig .update_layout (font = font_settings )
604
- # fig.show()
609
+ fig .show ()
605
610
# Save the figure
606
611
fig .write_image ("author_karma_vs_nb_of_stories.png" )
607
612
@@ -709,7 +714,7 @@ def main():
709
714
analyze_contributions_vs_score ()
710
715
analyze_type_per_time ()
711
716
analyze_commentators_behavior ()
712
- # analyze_contributions_vs_score_v2()
717
+ analyze_contributions_vs_score_v2 ()
713
718
714
719
if __name__ == "__main__" :
715
720
main ()
0 commit comments