In [71]:
import pandas
import numpy as np
In [72]:
%cd C:\Users\da.angulo39\Documents\MATLAB\kmc400_mars
In [73]:
thr = 0.05
In [74]:
p_file="at_corrected_p.csv"
effect_file="at_conts.csv"
excel_file="atencion_mb.xlsx"
excel_file_p="atencion_mb_ps.xlsx"
filter_name_char="_"
#p_file="co_corrected_p.csv"
#effect_file="co_conts.csv"
#excel_file="coordinacion_mb.xlsx"
#excel_file_p="coordinacion_mb_ps.xlsx"
#filter_name_char="-"
In [75]:
ef = pandas.read_csv(effect_file,index_col=0)
ef.head()
Out[75]:
In [76]:
ps = pandas.read_csv(p_file,index_col=0)
ps.head()
Out[76]:
In [77]:
ps2=ps.copy()
ps3=ps2>=thr
ps3.sum()/float(len(ps3.index))
Out[77]:
In [78]:
ps2[ps3]=float("nan")
ps2.head()
Out[78]:
In [79]:
ef2=ef.copy()
ef2[ps3]=float("nan")
ef2.head()
Out[79]:
In [80]:
#remove last column
ef3=ef2[ef2.columns[:-1]]
col_names = [c.split(filter_name_char)[0] for c in ef3.columns]
ef3.columns=col_names
ef3.head()
Out[80]:
In [81]:
ef3.to_excel(excel_file,merge_cells=False)
In [82]:
ps4=ps2[ps2.columns[:-1]]
ps4.columns=col_names
ps4.to_excel(excel_file_p,merge_cells=False)
In [82]: