Skip to content

Instantly share code, notes, and snippets.

@vashu1
Created September 21, 2022 12:47
Show Gist options
  • Save vashu1/0b75aaf8c19a9b6a58595e09f4e14cd5 to your computer and use it in GitHub Desktop.
Save vashu1/0b75aaf8c19a9b6a58595e09f4e14cd5 to your computer and use it in GitHub Desktop.
# download https://github.com/Basistiy/duma/blob/master/data/edata.csv
from collections import Counter
import matplotlib.pyplot as plt
lines = open('edata.csv').readlines()[1:]
lines = [i.strip() for i in lines]
totals = [int(i.split(',')[-4]) for i in lines]
ers = [int(i.split(',')[-5]) for i in lines]
rats = [b/a*100 for a, b in zip(totals, ers) if a>0]
from matplotlib import pyplot
a = Counter([round(i) for i in rats])
xs = list(range(0, 101))
plt.plot(xs, list([a[i]for i in xs]))
plt.show()
t1 = 0.5
def aa(v):
c1 = c2 = 0
for i in rats:
if v - t1 < i < v:
c1 += 1
if v < i < v + t1:
c2 += 1
return c1, c2
for p in range(50, 100, 5):
c1, c2 = aa(p)
print(p, c1 > c2, round((c1-c2)/(c1+c2), 3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment