Search for question
Question

Write a program on the following two questions. Both Sections A and B should be written in one

program.

A (PANDAS: SERIES) Perform the following tasks with pandas Series:

a. Create a Series from the list [7, 11, 13, 17].

b. Create a Series with five elements that are all 100.0.

c. Create a Series with 20 elements that are all random numbers in the

range 0 to 100. Use method describe to produce the Series' basic descriptive

statistics.

d. Create a Series called temperatures of the floating-point

values 98.6, 98.9, 100.2 and 97.9. Using the index keyword argument, specify

the custom indices 'Julie', 'Charlie', 'Sam' and 'Andrea'.

e. Form a dictionary from the names and values in Part (d), then use it to initialize

a Series.

B (PANDAS: DATAFRAMES) Perform the following tasks with pandas DataFrames:

f. Create a DataFrame named temperatures from a dictionary of three temperature

readings each for 'Maxine', 'James' and 'Amanda'.

g. Recreate the DataFrame temperatures in Part (a) with custom indices using

the index keyword argument and a list

containing 'Morning', 'Afternoon' and 'Evening'.

h. Select from temperatures the column of temperature readings for 'Maxine'.

i. Select from temperatures the row of 'Morning' temperature readings.

j. Select from temperatures the rows for 'Morning' and 'Evening' temperature

readings.

k. Select from temperatures the columns of temperature readings

for 'Amanda' and 'Maxine'.

1. Select from temperatures the elements for 'Amanda' and 'Maxine' in

the 'Morning' and 'Afternoon'.

m. Use the describe method to produce temperatures descriptive statistics.

n. Transpose temperatures.

o. Sort temperatures so that its column names are in alphabetical order.