Consider the given NumPy arrays a and b. What will be the value of c after the following code is executed?
import numpy as np

a = np.arange(8)
b = a[4:6]
b[:] = 40
c = a[4] + a[6]

Practice More Questions From: Final Quiz

Q:

Consider the given NumPy arrays a and b. What will be the value of c after the following code is executed? import numpy as npa = np.arange(8)b = a[4:6]b[:] = 40c = a[4] + a[6]

Q:

Given the string s as shown below, which of the following expressions will be True? import res = ‘ABCAC’

Q:

Consider the following 4 expressions regarding the above pandas Series df. All of them have the same value except one expression. Can you identify which one it is?

Q:

Consider the two pandas Series objects shown above, representing the no. of items of different yogurt flavors that were sold in a day from two different stores, s1 and s2. Which of the following statements is True regarding the Series s3 defined below?s3 = s1.add(s2)

Q:

In the following list of statements regarding a DataFrame df, one or more statements are correct. Can you identify all the correct statements?

Q:

Consider the Series object S defined below. Which of the following is an incorrect way to slice S such that we obtain all data points corresponding to the indices ‘b’, ‘c’, and ‘d’? S = pd.Series(np.arange(5), index=[‘a’, ‘b’, ‘c’, ‘d’, ‘e’])

Q:

Consider the DataFrame df shown above with indexes ‘R1’, ‘R2’, ‘R3’, and ‘R4’. In the following code, a new DataFrame df_new is created using df. What will be the value of df_new[1] after the below code is executed? f = lambda x: x.max() + x.min()df_new = df.apply(f)

Q:

Consider the DataFrame named new_df shown above. Which of the following expressions will output the result (showing the head of a DataFrame) below?

Q:

df.groupby(‘Item’).sum().iloc[0][‘Quantity sold’]

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments