Assume s and t are Numpy arrays with 100 rows and 300 columns. Consider the following two statements:
x = numpy.where(s > 1000, 100, t)
y = (s + t) > 10
Is x an array or a single value? Tell me what you can about its value or values. Is y an array or a single value? Tell me what you can about its value or values.
code:
s = numpy.arange(30000).reshape((100, 300))
print("array s is \n",s)
t = numpy.arange(30000).reshape((100, 300))
print("array t is \n",t)
x = numpy.where(s > 1000, 100, t)
y = (s + t) > 10
print("value of x is \n",x)
print("value of y is \n",y)
explanation:
here s and t are arrays with 100 rows and 300 columns.
for showing example i written 30000 values in arrays s and t using numpy.arange(30000)
reshape is used to show 30000 values as 100 rows and 300 columns .
here x=numpy.where(s>1000,100,t)
it print array of values with 100 rows and 300 columns.
here if cell value of s is >1000 then we place 100 otherwise we place t cell value with same row and column index.
y is printing boolean matrix with 100 rows and 300 columns.
sum of s[i][j]+t[i][j]>10 then we put TRUE OTHERWISE FALSE
output:
![array s is [[ 300 [600 299] 599] 899] 1 2... 297 298 301 302 597 598 601 602 897 898 [29100 29101 29102 29400 29401 29402 [29](http://img.homeworklib.com/questions/5ee9fcd0-c656-11ea-8ef2-d7ce2a5ac66d.png?x-oss-process=image/resize,w_560)
Assume s and t are Numpy arrays with 100 rows and 300 columns. Consider the following...
Problem 1: Consider 2 integer arrays, x and y, of the same size (assume size = 10). Initialize array x with random numbers between 1 and 100. Write code that fills array y with values such that each element of y is the corresponding value of x multiplied by its index.
D Question 12 1.5 pts Check the true statements about NumPy arrays: O A single instantiated NumPy array can store multiple types (e.g., ints and strings) in its individual element positions. A NumPy array object can be instantiated using multiple types (e.g., ints and strings) in the list passed to its constructor O Memory freeing will require a double-nested loop. The number of bits used to store a particular NumPy array object is fixed. O The numpy.append(my.array, new_list) operation mutates...
(10 pts) Define a two-dimensional array named temp with three rows and four columns of type int such that the first row is initialized to 6, 8, 12, 9; the second row is initialized to 10, 13, 6, 16; and the third row is initialized to 27, 5, 10, 20. (10 pts) Consider the following declarations, and see p.566: enum brands = { GM, FORD, TOYOTA, BMW, KIA }; const int N_BRANDS = 5; const int COLOR_TYPES = 6; double...
do it in python 1. Import the proper libraries: Pandas and NumPy and create aliases pd, np respectively. 2. Load sample data (car_loan.csv) into data frame: df 3. Export Pandas DataFrames to csv. Save file name as out.csv. hint: help(df.to_csv) 4. Run the command: df.info (). What do you see, how many columns? also what about number of entries for each column 5. It is often the case where you change your column names or remove unnecessary columns. a. Change...
1 Program 2-paramter Weibull distribution with β 100 rows by copying down the equation from Table 4.1. In the next column generate 1000 rows and in the next column 10 000 rows. Calculate the mean and standard deviation for each column. By hitting Recalculate' (typically F9) observe the mean and standard deviation values. What can you say about the variation for each group? 3.0 and η 000 into Excel spreadsheet and generate 2. When simulating the function Z-X where X...
Consider the following statements: int numbers[][] = {{1}, {1, 2}, {1, 2, 3}}; What is the size of the array? 3 rows, 3 columns 3 rows, 1 column 1 row, 3 columns 3 rows, 2 columns When you declare an array using the following statement inside a function, the element values are automatically initialized to 0. int matrix[5][5]; How many elements are array matrix[5][5][2]?
For the following C statement, what is the corresponding MIPS assembly code? Assume the arrays hold 16-bit integer values, $ s0 is the base for array X, $ s1 is the base for array Y, and $ t0 and $ t1 are index variables i and j respectively. Comment code X [j] = Y [i + j];
Your array shall have 3 rows and 3 columns (row and column indices are from 0 to 2). You shall initialize all elements of your array with character 'v' Player-1 is assigned 'X' symbol and player-2 is assigned 'O' symbol. Player-1 shall start the game and enter row index and column index where (s)he wants to place an 'X'. The board is updated and displayed. Now player-2 is asked to enter row and column indices If any player tries to...
Arrays Artistic Solutions wants to keep track of 100 of customers, including the following fields: Customer ID Last Name First Name Street Address City State Zip Code Phone Number Email Address Without access to a database program, you decide that keeping this information in one or more arrays is the best solution. The question is, what kind or kinds of arrays would you use? Discuss whether any or all of the following is suitable for this application, indicating why you...
Consider the following example of the IS-LM model: C = 300 + 0.5(Y–T) I = 400 – 1000(r + x) G = 250 T = 200 x=0.03 πe = 0.02 Derive the IS equation. Suppose that the nominal interest rate is 4% (i = 0.04). Find the equilibrium value of Y. Suppose that the risk premium x has increased to x=0.1. Suppose that the Fed wants to maintain the equilibrium value of Y at the value of Y...