biopsykit.metadata.metadata module¶
Module containing implementations to compute various metadata parameter.
Each function at least expects a dataframe containing the required columns in a specified order
(see function documentations for specifics) to be passed to the data
argument.
If data
is a dataframe that contains more than the required two columns, e.g., if the complete dataframe
is passed, the required columns can be sliced by specifying them in the columns
parameter.
- biopsykit.metadata.metadata.bmi(data, columns=None)[source]¶
Compute the Body Mass Index.
This function assumes the required data in the following format:
1st column: weight in kilogram
2nd column: height in centimeter
If
data
is a dataframe that contains more than the required two columns, e.g., if the complete questionnaire dataframe is passed, the required columns can be sliced by specifying them in thecolumns
parameter.- Parameters
data (
DataFrame
) – dataframe containing weight and height informationcolumns (sequence of str, optional) – list of column names needed to compute body mass index. Only needed if
data
is a dataframe with more than the required columns for computing body mass index. Not needed ifdata
only contains the required columns. Default:None
- Returns
dataframe with body mass index
- Return type
- Raises
ValueRangeError – if input values or output values are not in the expected range, e.g., because values are provided in the wrong unit or columns are in the wrong order
- biopsykit.metadata.metadata.whr(data, columns=None)[source]¶
Compute the Waist to Hip Ratio.
This function assumes the required data in the following format:
1st column: waist circumference
2nd column: hip circumference
If
data
is a dataframe that contains more than the required two columns, e.g., if the complete questionnaire dataframe is passed, the required columns can be sliced by specifying them in thecolumns
parameter.- Parameters
data (
DataFrame
) – dataframe containing waist and hip circumferencecolumns (sequence of str, optional) – list of column names needed to compute body mass index. Only needed if
data
is a dataframe with more than the required columns for computing body mass index. Not needed ifdata
only contains the required columns. Default:None
- Returns
dataframe with waist to hip ratio
- Return type
- Raises
ValueRangeError – if input values or output values are not in the expected range, e.g., because values are provided in the wrong unit or column are in the wrong order
- biopsykit.metadata.metadata.gender_counts(data, gender_col=None, split_condition=False)[source]¶
Get statistics about gender distribution from a dataset.
- Parameters
data (
DataFrame
) – dataframe with subjectsgender_col (str, optional) – column name containing gender information or
None
to use default name (“gender”).split_condition (bool, optional) –
True
to split gender distribution by condition (assumes that an “condition” index level is present indata
),False
otherwise. Default:False
- Returns
dataframe with absolute and relative gender distribution
- Return type