Created
October 22, 2015 00:29
-
-
Save osin-vladimir/0b70e93acb5f76ccb667 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#read from file | |
fname = "educated_people.txt" | |
with open(fname) as f: | |
educated_people = f.read().splitlines() | |
f.close | |
fname = "birthdate.txt" | |
with open(fname) as f: | |
birthdate = f.read().splitlines() | |
f.close | |
fname = "universities_all.txt" | |
with open(fname) as f: | |
universities_all = f.read().splitlines() | |
f.close | |
print len(educated_people) | |
print len(birthdate) | |
print len(universities_all) | |
import numpy as np | |
A = np.zeros([len(educated_people), len(educated_people)]) | |
for i in range(len(educated_people)): | |
for j in range(len(educated_people)): | |
if abs(int(birthdate[i]) - int(birthdate[j])) < 5: | |
A[i,j] = 1 | |
print A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment