Consider the following python methods, available in naive python, or numpy library: C-1. len() C-2. str.replace()...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Consider the following python methods, available in naive python, or numpy library: C-1. len() C-2. str.replace() C-3. str.join() C-4. np.random.randint() C-5. np.random.rand() C-6. np.sort() C-7. np.argsort() C-8. array.copy( C-9. array.reshape() C-10. np.argmin() Answer the following questions for each of the above methods: State the purpose/usage of the method. List all the arguments of the method. Classify the arguments as positional or keyword arguments. Write the default values for each of the keyword arguments. Answer the following questions: D-1. Create a random integer numpy nd-array of size 5x8, where the integer values range from 10 to 90. Set the random generator seed to be 211. Call the nd-array as M. D-2. Subtract 5 from all the elements of M. D-3. Subtract 5 from all the third-row elements of M. D-4. Subtract 5 from all the fifth column elements of M. D-5. Divide all the row 2 and 3 elements of M with 10. D-6. Create a copy of M, as M1. In M1, update each element as follows: if the element's value is <50, then update it to 0; otherwise, update the value to 100. Print both arrays (M and MI). D-7. Split M into two nd-arrays of size 3x8 and 2x8. D-8. Create a list of 8 random integers whose value ranges from 1 to 5. Append (attach) the list as the sixth row to M. D-9. Create a list of 5 random integers whose value ranges from 1 to 5. Append (attach) the list as the ninth column to M. D-10. Execute the following cells, and explain your observations: list1 = [1,2,3,4] print((lambda x: x * 3 )(list1)) array1 = np.array([1,2,3,4]) print((lambda x: x * 3 )(array1)) Consider the following python methods, available in naive python, or numpy library: C-1. len() C-2. str.replace() C-3. str.join() C-4. np.random.randint() C-5. np.random.rand() C-6. np.sort() C-7. np.argsort() C-8. array.copy( C-9. array.reshape() C-10. np.argmin() Answer the following questions for each of the above methods: State the purpose/usage of the method. List all the arguments of the method. Classify the arguments as positional or keyword arguments. Write the default values for each of the keyword arguments. Answer the following questions: D-1. Create a random integer numpy nd-array of size 5x8, where the integer values range from 10 to 90. Set the random generator seed to be 211. Call the nd-array as M. D-2. Subtract 5 from all the elements of M. D-3. Subtract 5 from all the third-row elements of M. D-4. Subtract 5 from all the fifth column elements of M. D-5. Divide all the row 2 and 3 elements of M with 10. D-6. Create a copy of M, as M1. In M1, update each element as follows: if the element's value is <50, then update it to 0; otherwise, update the value to 100. Print both arrays (M and MI). D-7. Split M into two nd-arrays of size 3x8 and 2x8. D-8. Create a list of 8 random integers whose value ranges from 1 to 5. Append (attach) the list as the sixth row to M. D-9. Create a list of 5 random integers whose value ranges from 1 to 5. Append (attach) the list as the ninth column to M. D-10. Execute the following cells, and explain your observations: list1 = [1,2,3,4] print((lambda x: x * 3 )(list1)) array1 = np.array([1,2,3,4]) print((lambda x: x * 3 )(array1))
Expert Answer:
Answer rating: 100% (QA)
Q1 Sure here are the answers to your questions for each of the mentioned Python methods including whether they are available in naive Python or the NumPy library C1 len PurposeUsage Determines the cou... View the full answer
Related Book For
Discrete and Combinatorial Mathematics An Applied Introduction
ISBN: 978-0201726343
5th edition
Authors: Ralph P. Grimaldi
Posted Date:
Students also viewed these programming questions
-
What is the forecasted capital expenditure based on the information below? \\Net PP&E beginning of period: 15,000 Net PP&E end of period: 17,500 Depreciation expenses: 2,400
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
Your task: You are asked to write a function that applies Simulated Annealing to a Traveling Salesman Problem. That is, your function will run simulated annealing as discussed in class and report...
-
We look at the accumulated area beneath this curve, as in the definite integral as follows F(x) = f(t) dt -2 { F(x) = int_(-2)^x f(t) dt a) Use ordinary area formulas to compute each of the...
-
Verify that the function satisfies the hypotheses of the Mean Value Theorem on the given interval. Then find all numbers c that satisfy the conclusion of the Mean Value Theorem. 11. f(x) = 3r + 2r +...
-
Discuss the topic of a changing competitive environment and how as a DBA practitioner, you can leverage your project's findings to inform leaders of how best to adapt to the changing marketplace.
-
Recall that the density of a gamma distribution with shape parameter \(\alpha\) and scale parameter \(\theta\) has a density given by \(\mathrm{f}(y)=\) \(\left[\theta^{\alpha} \Gamma(\alpha)...
-
Jaynet spends $20,000 per year on painting supplies and storage space. She recently received two job offers from a famous marketing firmone offer was for $100,000 per year, and the other was for...
-
JLB Enterprises acquired 15% of REB Corporation on January 1, 2018, for $63,000 when th book value of REB's net assets was $360,000. During 2018, REB reported net income of $90.00 and paid dividends...
-
A headlight produced by Enterprise Lumiere was found to be defective. The company has three factories (labeled below as A. B, and C) where such headlights are manufactured. A Quality Control Manager...
-
The table below gives the activity duration and precedence relationships for a small project consisting of six activities. Also shown is the cost per day of crashing each activity and the maximum...
-
Indicate whether each of the following statements is true or false by writing T or F in the answer column. An architect who designs a building that is later destroyed in a windstorm cannot be charged...
-
Indicate whether each of the following statements is true or false by writing T or F in the answer column. An insurance agent or broker can be charged with negligence for failing to recommend...
-
Indicate whether each of the following statements is true or false by writing T or F i n t he a nswer c olumn. The doctrine of comity holds that the courts of one country should refrain from deciding...
-
Draw a logic diagram using gates and flip-flops showing the circuit of one bus arbiter stage in the daisy-chain arbitration scheme of Fig. 13-10. Fig. 13-10 PI Highest priority Bus PO arbiter 1 PI...
-
Indicate whether each of the following statements is true or false by writing T or F i n t he a nswer c olumn. There is little or no relationship between international law and international trade.
-
solution Prove that, variance 2 E [(x-)] = E(X3- Ma
-
Write electron configurations for the following ions, and determine which have noble-gas configurations: (a) Cd2+ (b) p3- (c) Zr4+ (d) Ru3+ (e) As3- (f) Ag+
-
(a) Determine P(G, ) for G = K1,3. b) For n e Z+, what is the chromatic polynomial for K1,n? What is its chromatic number?
-
Determine the number of integer solutions to x1 + x2 + x3 + x4 = 19 where - 5 < x1 < 10 for all 1 i 4.
-
(a) Apply Dijkstra's algorithm to the weighted graph G = (V, E) in Fig. 13.4, and determine the shortest distance from vertex a to each of the other six vertices in G. Here wt(e) = wt(x, y) = wt(y,...
-
A nickel crystals work function is measured to be 5.22 eV at 25C. As the temperature increases by 300C, the work function drops by 50 meV. By how much does this shift the threshold wavelength for...
-
A crystal sample of bacteriorhodpsin, a light-sensitive protein found in halobacteria that responds to light energy, has crystal planes separated by 0.20 nm. If a beam of 11 keV x rays illuminates a...
-
Investigators have created structures consisting of linear chains of ionized atoms on a smooth surface. Electrons are restricted to travel along the chain. The energy levels of the electrons match...
Study smarter with the SolutionInn App