Question
Q1.Suppose you are given a df data frame. df = pd.DataFrame ({'Click_Id': ['A', 'B', 'C', 'D', 'E'], 'Count': [100,200,300,400,250]}) Now you want to change the
Q1.Suppose you are given a df data frame.
df = pd.DataFrame ({'Click_Id': ['A', 'B', 'C', 'D', 'E'], 'Count': [100,200,300,400,250]})
Now you want to change the column name "Count " in df to
" Click_Count ". So, you wrote the following code to accomplish this step.
df.rename (columns = {'Count': 'Click_Count'})
What will be the result of the printout below? print df.columns
(CHOOSE RIGHT ANSWER)
- ['Click_Id', 'Click_Count']
- ['Click_Id', 'Count']
- Print Error
- None of the above
Q2.Consider the function fun, which is defined below:
def fun (x):
x [0] = 5
return x
There is a list with three numbers.
g = [10,11,12]
Which of the following will be the output of this print statement:
print fun (g), g
(CHOOSE RIGHT ANSWER)
- [5, 11, 12] [5, 11, 12]
- [5, 11, 12] [10, 11, 12]
- [10, 11, 12] [10, 11, 12]
- [10, 11, 12] [5, 11, 12]
Q3.Suppose you are given two lists:
a = [1,2,3,4,5]
b = [6,7,8,9]
The challenge is to create a list containing all the elements a and b in one dimension.
(CHOOSE RIGHT ANSWER)
- a.append (b)
- a.extend (b)
- Any of the above
- None of the above
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