Question
16.2 (True or False) A pandas DataFrame can contain homogenous data only. (a) True (b) False 16.3 (True or False) When developing a pandas dataframe,
16.2 (True or False) A pandas DataFrame can contain homogenous data only.
(a) True
(b) False
16.3 (True or False) When developing a pandas dataframe, if the series to be merged have a different number of rows, an error occurs and the frame is not generated.
(a) True
(b) False
16.4 (Multiple Choice) A user created a dataframe using the following code:
import numpy as np
import pandas as pd
example_df = pd.DataFrame(np.random.normal(90,8,(8,5)),
index=pd.date_range('10-28-2019',periods=8,freq="W"),
columns=['M','T','W','R','F'])
print(example_df)
The output is
M T W R F
2019-11-03 91.721930 80.147716 90.292496 88.572601 80.357348
2019-11-10 85.894185 80.284552 80.252252 75.451777 70.847433
2019-11-17 94.197586 89.661367 82.268884 79.437666 78.727944
2019-11-24 90.592618 80.933793 84.625637 87.243930 77.233178
2019-12-01 83.141369 77.746376 85.319763 87.986341 76.386793
2019-12-08 94.746199 74.840162 85.479185 92.106242 84.319469
2019-12-15 82.029095 74.768946 86.718234 94.652655 93.202357
2019-12-22 84.367290 89.935810 84.349015 100.656722 79.348850
For the above DataFrame, example_df[example_df.columns[1]][4] will return?
(a) 90.592618
(b) 77.746376
(c) 88.572601
(d) 70.847433
16.5 (Multiple Choice) For the DataFrame created in 16.4, example_df['R'].cumsum() will result in the value for 2019-11-24 being?
(a) 87.243930
(b) [87.243930]
(c) 330.705975
(d) 462.645890
16.6 (Multiple Choice) For the DataFrame created in 16.4, if all values below 90 are replaced with NaN using replace and np.nan, the code example_df['R'].cumsum()[4] will now return?
(a) 87.243930
(b) 330.705975
(c) 462.645890
(d) NaN
(e) 0
16.7 (Multiple Choice) For the DataFrame created in 16.4, For the above DataFrame, the following sequence of code occurs. What will be the value of "a"?
hold = example_df.stack()
example_df = hold.unstack(level=0)
a = example_df[example_df.columns[1]][4]
(a) 90.592618
(b) 77.746376
(c) 88.572601
(d) 70.847433
17.1 (True or False) QtDesigner automatically saves the GUI files in a format that can be utilized by Python code.
(a) True
(b) False
17.2 (Multiple Choice) Which of the following are steps in the general GUI program development outlined in the course:
(a) Design in the Qt Designer
(b) Convert to Python File using PyQt
(c) Code in Python
(d) All of the above
18.1 (True or False) The function "fmin_bfgs()" is the best function in the SciPy Optimization library for finding global minimums.
(a) True
(b) False
18.2 (True or False) The function "basinhopping()" will always find the global minimum of a function.
(a) True
(b) False
18.3 (Multiple Choice) The following code would display all of the following except:
from pulp import *
prob = LpProblem("Q18.3", LpMaximize)
x1 = LpVariable("x1", lowBound = 0)
x2 = LpVariable("x2", lowBound = 0)
prob += 15*x1 + 20*x2
prob += 2*x1 + 1*x2 <= 100
prob += 3*x1 + 1*x2 <= 75
print(prob)
(a) The objective function
(b) The optimal solution
(c) The variables
(d) The constraints
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started