Q9: Write the results of this coding: # Create a new array from which we will...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Q9: Write the results of this coding: # Create a new array from which we will select elements a = np.array([[1,2,3], [4,5,6], [7,8,9], [10, 11, 12]]] b = np.array([0, 2, 0, 1]) print(a[np.arange(4), b]) Q10: Assume you have this data set (df) defined Pandas in python 1 df W Q11: Write the results of this coding: case = [4,2,4,2] prob = [1/4,1/4,1/4,1/4] X A -0.896946 -1.317051 -1.245883 0.766704 B 0.533140 0.369031 0.346393 -0.381692 с 0.749388 -1.029544 1.653251 1.366307 D 0.513013 -0.112036 -0.666242 -0.637730 E 0.221772 -0.014715 0.259359 0.361838 -> Please write the code to pull out the results satisfying these requirements at the same time: all values from W are positive, all values from Y and Z are negative ex_another = sum( c*p for c, p in zip(case, prob)) print(ex_another) Q12: Write the results of this coding: import pandas as pd import numpy as np student_df.head() Y name = ['Jon', 'Nick', 'Ben', 'Josh'] eduation = [9, 'Graduate', 7, 8] col= ('name':name, 'Qualification':eduation) Z student_df = pd.DataFrame(col) student_dfl'q_numeric'] = pd.to_numeric(student_df["Qualification"],errors='co- erce',downcast='integer') Q9: Write the results of this coding: # Create a new array from which we will select elements a = np.array([[1,2,3], [4,5,6], [7,8,9], [10, 11, 12]]] b = np.array([0, 2, 0, 1]) print(a[np.arange(4), b]) Q10: Assume you have this data set (df) defined Pandas in python 1 df W Q11: Write the results of this coding: case = [4,2,4,2] prob = [1/4,1/4,1/4,1/4] X A -0.896946 -1.317051 -1.245883 0.766704 B 0.533140 0.369031 0.346393 -0.381692 с 0.749388 -1.029544 1.653251 1.366307 D 0.513013 -0.112036 -0.666242 -0.637730 E 0.221772 -0.014715 0.259359 0.361838 -> Please write the code to pull out the results satisfying these requirements at the same time: all values from W are positive, all values from Y and Z are negative ex_another = sum( c*p for c, p in zip(case, prob)) print(ex_another) Q12: Write the results of this coding: import pandas as pd import numpy as np student_df.head() Y name = ['Jon', 'Nick', 'Ben', 'Josh'] eduation = [9, 'Graduate', 7, 8] col= ('name':name, 'Qualification':eduation) Z student_df = pd.DataFrame(col) student_dfl'q_numeric'] = pd.to_numeric(student_df["Qualification"],errors='co- erce',downcast='integer')
Expert Answer:
Answer rating: 100% (QA)
Q9 The code creates a new NumPy array a and an array b of indices It then uses fancy indexing to se... View the full answer
Related Book For
Statistics For Business And Economics
ISBN: 9781292227085
13th Global Edition
Authors: Terry Sincich James Mcclave, P. George Benson
Posted Date:
Students also viewed these programming questions
-
If the focal length of a lens is 3 centimeters and the image distance is 5 centimeters from the lens, what is the distance from the object to the lens?
-
The temperature of air changes from 0 to 10C while its velocity changes from zero to a final velocity, and its elevation changes from zero to a final elevation. At which values of final air velocity...
-
In a survey of 700 community college students, 481 indicated that they have read a book for personal enjoyment during the school year (based on data from the Community College Survey of Student...
-
Determine whether v and w are parallel, orthogonal, or neither. v = 3i - 2j; w = 4i + 6j
-
On February 16, 2005, Joseph and Margaret Buset borrowed $192,000 from Fremont Investment & Loan (the Originator). The loan was secured by a mortgage on a residential condominium. The mortgage named...
-
Crede Inc. has two divisions. Division A makes and sells student desks. Division B manufactures and sells reading lamps. Each desk has a reading lamp as one of its components. Division A can purchase...
-
You are the owner of Poptastic. For the past few years, to help supplement your familys income, you have sold premium, homemade popsicles from your food truck and a few local businesses in Pensacola,...
-
The output of a discrete-time system is related to its input x[n] as follows: y[n] = @ox[n] + ax[n-1] + ax[n- 2] + a3x[n - 3]. Let the operator S denote a system that shifts the input x[n] by k time...
-
Which branch of government has recently increased land and water rights for Native Americans? Explain
-
A document that is issued by upper management and provides the project manager with written authority to use organizational resources for project activities is called?
-
A restaurant noted what type of food its customers ordered last week. Here are the results: Find the probability that a randomly chosen customer ordered a burger given that they ordered fries.
-
7. Explain the difference between the following three C function prototypes: void f(int n); extern void f(int n); static void f(int n);
-
The information of expected returns, betas, specific standard deviations of three assets, and their proportions in a portfolio is in the following table: Assets Expected return (%) Beta Specified...
-
assume the dependent variable Yi=10, 20, 15, 5 and the independent variable Xi=4, 5, 2, 1 Do RESET test. when m=1, the Fc for the test =-
-
Find the inverse, if it exists, for the matrix. -1
-
Refer to Exercise 12.82. a. Write a complete second-order model that relates E(y) to the quantitative variable. b. Add the main effect terms for the qualitative variable (at three levels) to the...
-
Refer to the International Journal for Traffic and Transport Engineering (Vol. 3, 2013) study of aircraft bird strikes at a Nigerian airport, Exercise 6.54. Recall that an air traffic controller...
-
Refer to Example 9.10. Suppose the same factorial experiment is performed on four other brands (E, F, G, and H), and the results are as shown in Table 9.16. Repeat the factorial analysis and...
-
Show that if a liquid is in equilibrium with its own vapour and an inert gas in a closed vessel, then \[\frac{\mathrm{d} p_{v}}{\mathrm{~d} p}=\frac{ho_{v}}{ho_{l}}\] where \(p_{v}\) is the partial...
-
a. Describe the meaning of the term thermodynamic equilibrium. Explain how entropy can be used as a measure of equilibrium and also how other properties can be developed which can be used to assess...
-
Show that when different phases are in equilibrium the specific Gibbs energy of each phase is equal. Using the following data, show the pressure at which graphite and diamond are in equilibrium at a...
Study smarter with the SolutionInn App