bmigraph.calculate_bmi

Module Contents

Functions

calculate_bmi(weight, height[, return_graph])

Calculate the body mass index (BMI) based on current weight and height.

bmigraph.calculate_bmi.calculate_bmi(weight, height, return_graph=False)[source]

Calculate the body mass index (BMI) based on current weight and height.

Body Mass Index (BMI) is a calculated measure of weight relative to height, defined as body weight in kilograms divided by height in meters squared (Keys et al., 1972). If return_graph is True, an plotly.graph_objects.Figure object instead of a bmi value.

Parameters:
  • weight (float) – Weight, in kilograms. Must have a positive value.

  • height (float) – Height, in meters. Must have a positive value.

  • return_graph (bool) – Whether to return a graph instead of a value

Returns:

If return_graph is False, we get a value of the body mass index. If return_graph is True, we get a plotly.graph_objects.Figure instead that can be saved or shared.

Return type:

float or plotly.graph_objects

Examples

>>> calculate_bmi(100, 1.85, return_graph=False)
>>> 29.218407596785973