Pandas dataframe.
Program - Python
This question tests whether you can learn a bit about something new (a popular Python library called Pandas) given your basic Python skills. You can find an example of how to do this problem in the class notes: I have a directory called Pandas and if you look in the Dataframes doc you can see how to do this. You create a dictionary and then turn that into a Pandas dataframe.
Suppose you have three lists that contain the height in meter, the corresponding weight in kilogram, and the body mass index (bmi) of the
height and weight as follow:
height = [1.47, 1.5, 1.52, 1.55, 1.57, 1.6, 1.63, 1.65, 1.68, 1.7, 1.73, 1.75, 1.78, 1.8, 1.83]
weight = [52.21, 53.12, 54.48, 55.84, 57.2, 58.57, 59.93, 61.29, 63.11, 64.47, 66.28, 68.1, 69.92, 72.19, 74.46]
bmi = [24.16, 23.61, 23.58, 23.24, 23.21, 22.88, 22.56, 22.51, 22.36, 22.31, 22.15, 22.24, 22.07, 22.28, 22.23]
Store the three lists in a pandas DataFrame. Call the DataFrame bmi_table. Call the columns height, weight, bmi.
Show the first 6 rows of the table
Step by step
Solved in 2 steps with 1 images