]> git.ipfire.org Git - thirdparty/google/fonts.git/commitdiff
Script to print basic tag stats (#7823)
authorRod <rsheeter@google.com>
Wed, 5 Jun 2024 21:58:11 +0000 (14:58 -0700)
committerGitHub <noreply@github.com>
Wed, 5 Jun 2024 21:58:11 +0000 (14:58 -0700)
tags/all/stats.py [new file with mode: 0644]

diff --git a/tags/all/stats.py b/tags/all/stats.py
new file mode 100644 (file)
index 0000000..dfa2fa1
--- /dev/null
@@ -0,0 +1,41 @@
+"""
+Result 5/29/2024:
+
+Num tags 9125
+Mean tags  5.086399108138239
+Median tags 5.0
+Stdev tags 2.474364733745681
+Max tags 27
+
+Usage:
+
+       clone https://github.com/google/fonts
+       write to a file in tags/all called stats.py
+       python3 stats.py
+"""
+
+import collections
+import csv
+from pathlib import Path
+from statistics import mean, median, stdev
+
+def main():
+       with open('families.csv') as f:
+               reader = csv.DictReader(f)
+               records = [r for r in reader]
+
+       count_by_family = collections.defaultdict(int)
+       for r in records:
+               count_by_family[r["Family"]] += 1
+       
+       counts = sorted(count_by_family.values())
+
+       print("Num tags", len(records))
+       print("Mean tags ", mean(counts))
+       print("Median tags", median(counts))
+       print("Stdev tags", stdev(counts))
+       print("Max tags", max(counts))
+
+
+if __name__ == '__main__':
+       main()
\ No newline at end of file