\(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\R}[1]{ {\rm #1} }\)
csv.covariate_avg¶
View page sourceCompute Covariate Averages for One Node¶
Prototype¶
# at_cascade.csv.covariate_avg
def covariate_avg(covariate_table, node_name, sex) :
assert type(covariate_table) == list
assert type(covariate_table[0]) == dict
assert type(node_name) == str
assert sex in [ 'female', 'male', 'both' ]
# ...
assert type(covariate_average) == dict
for value in covariate_average.values() :
assert type(value) == float
return covariate_average
covariate_table¶
Is a list of dict representation of a
covariate.csv file.
All of the columns in this table have been converted to float
except for node_name and sex which have type str .
In addition, sex equal to both may have been added; see
csv.covariate_both .
node_name¶
is a str contain the name of the node that we are computing the average for.
covariate_average¶
This return is a dict where the keys are the covariates in covariate.csv and the values are the average of the corresponding covariate.
sex¶
is the sex that this average is for.