Skip to content

Instantly share code, notes, and snippets.

@tripleee
Last active December 2, 2022 11:22
Show Gist options
  • Save tripleee/bbefec677b2d4049f4d540bc28ce0b34 to your computer and use it in GitHub Desktop.
Save tripleee/bbefec677b2d4049f4d540bc28ce0b34 to your computer and use it in GitHub Desktop.
Amount of bad questions on Stack Overflow per weekday
import csv
import sys
wd = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
# https://data.stackexchange.com/stackoverflow/query/1681084
with open(sys.argv[1], "r") as csvfile:
reader = csv.reader(csvfile)
header = True
for row in reader:
newrow = []
for i, field in enumerate(row):
newrow.append(wd[int(field)-1] if i == 0 and not header else field)
if i > 1:
if header:
newrow.append("of total")
else:
newrow.append(int(10000*int(field)/int(row[1]))/10000)
print("|", " | ".join(f"{x:21}" for x in newrow), "|")
if header:
print("|", " | ".join("-" * 21 for x in newrow), "|")
header = False
day # of questions Closed within 4 hours of total Closed within a day of total # Closed of total # deleted of total
Monday 975367 240978 0.247 89023 0.0912 376356 0.3858 720003 0.7381
Tuesday 1007216 243910 0.2421 90726 0.09 382761 0.38 740449 0.7351
Wednesday 1006870 239879 0.2382 90735 0.0901 380283 0.3776 738417 0.7333
Thursday 988047 235026 0.2378 90276 0.0913 376508 0.381 724396 0.7331
Friday 907813 216371 0.2383 85476 0.0941 353725 0.3896 664752 0.7322
Saturday 622322 143978 0.2313 75045 0.1205 256154 0.4116 460035 0.7392
Sunday 623906 150002 0.2404 76488 0.1225 257115 0.4121 460779 0.7385
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment