Skip to content

Instantly share code, notes, and snippets.

@Radcliffe
Created January 16, 2023 00:58
Show Gist options
  • Save Radcliffe/110e7a7afaa6cd413e493409683ed524 to your computer and use it in GitHub Desktop.
Save Radcliffe/110e7a7afaa6cd413e493409683ed524 to your computer and use it in GitHub Desktop.
Count knots with Arf invariant zero by crossing number
import csv
import requests
from collections import Counter
import json
url = 'https://raw.githubusercontent.com/soehms/database_knotinfo/main/database_knotinfo/csv_data/knotinfo_data_complete.csv'
with requests.Session() as session:
download = session.get(url)
decoded = download.content.decode('utf-8')
reader = csv.DictReader(decoded.splitlines(), delimiter='|')
data = list(reader)
counts = Counter(int(row['crossing_number']) for row in data if row['arf_invariant'] == "0")
for crossing_number, count in sorted(counts.items()):
print(crossing_number, count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment