Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. array1 = {[*unique ID's*, *date*, *number of hours*, *average output per hour*],
  2. ...}
  3.  
  4. array1 = {[10213, 19660101, 720, 36.6],
  5. [10215, 19550102, 430, 25.5],
  6. [10215, 19550202, 255, 30.1],
  7. ...}
  8.  
  9. unique_ID = np.unique(numpy_During[:, 0])
  10. print("starting creation of sub arrays")
  11. for x in np.nditer(unique_ID):
  12. temp = np.where(numpy_During[:, 0] == x)
  13. for value in np.nditer(temp):
  14. if str(int(x)) in list_of_ID:
  15. try:
  16. if max_Hours[str(int(x))] > 13140:
  17. break
  18. new_Array = np.empty([int(numpy_During[value, 2]), 6])
  19. new_Array[:, :] = numpy_During[value, :]
  20. old_Array = numps[str(int(x))]
  21. my_Stacker = (old_Array, new_Array)
  22. combined_Array = np.vstack(my_Stacker)
  23. numps[str(int(x))] = combined_Array
  24. max_Hours[str(int(x))] += numpy_During[value, 2]
  25. except:
  26. print("volume period of NaN")
  27. else:
  28. try:
  29. list_of_ID.append(str(int(x)))
  30. new_Array = np.empty([int(numpy_During[value, 2]), 6])
  31. new_Array[:, :] = numpy_During[value, :]
  32. numps[str(int(x))] = new_Array
  33. max_Hours[str(int(x))] = numpy_During[value, 2]
  34. except:
  35. print("volume period of NaN")
  36.  
  37. panda['sum_calc'] = panda['per_hour'].rolling(window=size, center=False).sum()
  38. calc = panda.loc[panda['sum_calc'] == panda['sum_calc'].max(), 'sum_calc']
  39. calc_index = int(sum_calc._index.data[0]) # gets row number
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement