Advertisement
Guest User

Armar el grafico desde el set

a guest
Apr 9th, 2020
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. import numpy as np
  2. import collections, functools, operator
  3. import matplotlib.pyplot as plt
  4.  
  5. s={}
  6. result={}
  7. with open('nombre_archivo.out') as f:
  8.     lines = f.readlines()
  9.     for line in lines:
  10.         s = dict(zip(*np.unique(np.fromstring(line, dtype=int, sep=','), return_counts=True)))
  11.         result = dict(functools.reduce(operator.add, map(collections.Counter, [result, s])))
  12.  
  13. plt.plot(list(result.keys())[1:], list(result.values())[1:], '.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement