Advertisement
Guest User

Untitled

a guest
Nov 24th, 2020
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. fname = 'satcat_download.txt'
  5.  
  6. with open(fname, 'r') as infile:
  7.     lines = infile.readlines()
  8.  
  9. dic = dict()
  10.  
  11. for line in lines:
  12.     year, num = int(line[0:4]), int(line[5:8])
  13.     try:
  14.         dic[year].append(num)
  15.     except:
  16.         dic[year] = [num]
  17.  
  18. data = [(a, sorted(set(b))) for a, b in sorted(dic.items())]
  19.  
  20. if True:
  21.     for a, b in data:
  22.         print(a, len(b), b[-1], len(b) == b[-1])
  23.  
  24. years = np.array([x[0] for x in data])
  25. number = np.array([len(x[1]) for x in data])
  26. highest = np.array([x[1][-1] for x in data])
  27.  
  28. disagree = highest != number
  29. yeardots = years[disagree]
  30. numberdots = number[disagree]
  31.  
  32. plt.figure()
  33. plt.plot(years, number)
  34. plt.plot(years, highest)
  35. plt.plot(yeardots, numberdots, 'ok', mfc='none', ms=20)
  36. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement