Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. # Extracting annual max value of the data
  2. from openpyxl import load_workbook
  3. from openpyxl import Workbook
  4. from operator import itemgetter
  5. fileUrl = r"C:UsersDWDesktoprainfall.xlsx"
  6.  
  7. wb = load_workbook(fileUrl)
  8. ws = wb.active
  9. all_data = []
  10. for row in ws.iter_rows(min_row=2,max_row=16072,max_col=64):
  11. temp = []
  12. for cell in row:
  13. temp.append(cell.value)
  14. all_data.append(temp)
  15. j = 0
  16. for i in range(1975,2019):
  17. temp = []
  18. while True:
  19. if (j < len(all_data) and i == all_data[j][0]):
  20. temp.append(all_data[j])
  21. else:
  22. max_list.append(max(temp, key = itemgetter(3,63)))
  23. break
  24. j += 1
  25. print('max_list ', str(max_list))
  26. wb2 = Workbook()
  27. sheet1 = wb2.active
  28. filename = 'max90.xlsx'
  29. for i in max_list:
  30. print(i)
  31. sheet1.append(i)
  32. wb2.save(filename=filename)
  33.  
  34. # to estimate parameters of distribution
  35. import pandas as pd
  36. import numpy as np
  37. import scipy as sp
  38. import scipy.stats as sps
  39. import seaborn as sns
  40. import matplotlib.pyplot as plt
  41. %matplotlib inline
  42. max90 = pd.read_excel(r"C:UsersDWDesktopmax90.xlsx")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement