Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Extracting annual max value of the data
- from openpyxl import load_workbook
- from openpyxl import Workbook
- from operator import itemgetter
- fileUrl = r"C:UsersDWDesktoprainfall.xlsx"
- wb = load_workbook(fileUrl)
- ws = wb.active
- all_data = []
- for row in ws.iter_rows(min_row=2,max_row=16072,max_col=64):
- temp = []
- for cell in row:
- temp.append(cell.value)
- all_data.append(temp)
- j = 0
- for i in range(1975,2019):
- temp = []
- while True:
- if (j < len(all_data) and i == all_data[j][0]):
- temp.append(all_data[j])
- else:
- max_list.append(max(temp, key = itemgetter(3,63)))
- break
- j += 1
- print('max_list ', str(max_list))
- wb2 = Workbook()
- sheet1 = wb2.active
- filename = 'max90.xlsx'
- for i in max_list:
- print(i)
- sheet1.append(i)
- wb2.save(filename=filename)
- # to estimate parameters of distribution
- import pandas as pd
- import numpy as np
- import scipy as sp
- import scipy.stats as sps
- import seaborn as sns
- import matplotlib.pyplot as plt
- %matplotlib inline
- max90 = pd.read_excel(r"C:UsersDWDesktopmax90.xlsx")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement