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)

  1. ['Click_Id', 'Click_Count']
  2. ['Click_Id', 'Count']
  3. Print Error
  4. 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)

  1. [5, 11, 12] [5, 11, 12]
  2. [5, 11, 12] [10, 11, 12]
  3. [10, 11, 12] [10, 11, 12]
  4. [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)

  1. a.append (b)
  2. a.extend (b)
  3. Any of the above
  4. None of the above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!