You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
prototype code to create excel with one sheet per prio and a grouped overview:
importpandasaspdcols= ['out_name', 'standard_name', 'long_name', 'cell_methods']
defhuman_readable(df):
returndf.groupby(cols)['frequency'].apply(list).to_frame()#.reset_index()#df.groupby('priority').apply(human_readable, include_groups=False)df=pd.read_csv("CORDEX-CMIP6/data-request.csv")
#human_readable(df)sheets= {k: human_readable(v) fork, vindf.groupby('priority')}
withpd.ExcelWriter('data-request.xlsx') aswriter:
fork, vinsheets.items():
v.to_excel(writer, sheet_name=k, index=True)
nlevels=v.index.nlevels+len(v.columns)
worksheet=writer.sheets[k] # pull worksheet objectforiinrange(nlevels):
worksheet.set_column(i, i, 40)
# for idx, col in enumerate(v): # loop through all columns# print(idx)# series = v[col]# max_len = max((# series.astype(str).map(len).max(), # len of largest item# len(str(series.name)) # len of column name/header# )) + 1 # adding a little extra space# worksheet.set_column(idx, idx, max_len) # set column width
We had one in the old data request, we should reimplement that here:
See als example from IMPETUS:
The text was updated successfully, but these errors were encountered: