Question

Write Python code that uses the np.split function to break up the array z created in...

Write Python code that uses the np.split function to break up the array z created in the previous problem into four arrays named with two columns each named zOne, zTwo, zThree, and zFour.

The following is the code to get z:

import numpy as np
x = np.array ([4,4,11,11,0,7,10,6,9,11,14,6,4,5,6],dtype='int64').reshape((3, 5))
y = np.array ([6,7,4,2,2,7,5,2,3],dtype='int64').reshape((3, 3))
z = np.concatenate([x,y],axis=1)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

import numpy as np
x = np.array ([4,4,11,11,0,7,10,6,9,11,14,6,4,5,6],dtype='int64').reshape((3, 5))
y = np.array ([6,7,4,2,2,7,5,2,3],dtype='int64').reshape((3, 3))
z = np.concatenate([x,y],axis=1)
[zOne,zTwo,zThree,zFour]=np.split(z,4,axis=1);
print(zOne);
print(zTwo);
print(zThree);
print(zFour);

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Write Python code that uses the np.split function to break up the array z created in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In Python import numpy as np Given the array a = np.array([[1, 2, 3], [10, 20,...

    In Python import numpy as np Given the array a = np.array([[1, 2, 3], [10, 20, 30], [100, 200, 300]]), compute and print the sums over all rows (should give [6, 60, 600]) the sums over all columns (the sum of he first column is 111) the maximum of the array the maxima over all rows the mean of the sub-array formed by omitting the first row and column the products over the first two columns (hint: look for an...

  • IN PYTHON 3 GIVING THIS CODE %matplotlib inline import numpy as np import matplotlib.pyplot as plt...

    IN PYTHON 3 GIVING THIS CODE %matplotlib inline import numpy as np import matplotlib.pyplot as plt from sklearn import datasets N_samples = 2000 X = np.array(datasets.make_circles(n_samples=N_samples, noise=0.05, factor=0.3)[0]) plt.scatter(X[:,0], X[:,1], alpha=0.8, s=64, edgecolors='white'); Use Spectral Clustering to cluster the points and visualize your result

  • 7. i) Let n and k be some given positive integers, and x a 1-dimensional NumPy...

    7. i) Let n and k be some given positive integers, and x a 1-dimensional NumPy array of length n. Write a Python code that creates the 2-dimensional NumPy array which has k columns all identical to x. You may import numpy as np Perform the test case: ne5 k-3 x = np.arange(0,1,0.2) # the output should be [[. 0. 0.] [0.2 0.2 0.2] [0.4 0.4 0.4) (0.6 0.6 0.6) [0.8 0.8 0.8]] 7. ii) Let a, b, c be...

  • python Problem 3-6 points First, start with the following code: import numpy as np A np.random....

    python Problem 3-6 points First, start with the following code: import numpy as np A np.random. randint (0, 10, sie n,n)) np. savetxt ('exam2.txt', A, fmt-idelimiter B-# np. zeros ( (n, n) , dtypes, int 64, ) When run, it will produce a file named "exam2.txt" that has 5 rows each with 5 numbers separated by commas,. In addition, a 5 by 5 array of zeros named B is defined. Run this code, but do not change it Your job...

  • #PYTHON# In this exercise you will write code which loads a collection of images (which are...

    #PYTHON# In this exercise you will write code which loads a collection of images (which are all the same size), computes a pixelwise average of the images, and displays the resulting average. The images below give some examples that were generated by averaging "100 unique commemorative photographs culled from the internet" by Jason Salavon. Your program will do something similar. Write a function in the cell below that loads in one of the sets of images and computes their average....

  • I need a Python code for this problem. We can use python's array slicing in many...

    I need a Python code for this problem. We can use python's array slicing in many ways, and here is just one example. To take the forward derivative of an array y, we use (y[i+1] - y[i])/dx For example, if dx=1 , we might write a derivative routine as yderiv = zeros (len(y)-1) for i in range(len(y)-1): yderiv[i] = y(i+1] - y[i] Note that here, yderiv is one element shorter than y -- this is because you need 2 points...

  • 1) Translate the following equation into a Python assignment statement 2) Write Python code that prints...

    1) Translate the following equation into a Python assignment statement 2) Write Python code that prints PLUS, MINUS, O ZERO, depending on the value stored in a variable named N. 3) What is printed by: 3 - 1 while 5: while 10 Print ) Page 1 of 9 4) Write a Python while loop that reads in integers until the user enters a negative number, then prints the sum of the numbers. 1-2 of 9 4) Write a Python while...

  • Need help completing code. (In python) Problem 2. Prepare the data for the lab In this...

    Need help completing code. (In python) Problem 2. Prepare the data for the lab In this problem you'll split the dataset into a training dataset and a test dataset and store them into separate arrays to work with: (a) Create a training set dataTR consisting of the first 500 and last 500 rows of the original dataset and a set dataTS with the remaining (middle) 372 rows. (b) Create 2D numpy arrays X-tr with rows [1.zi(1), Zi(2) , Zi(3) ,...

  • please use python thanks will rate!! x + Run C Code Validate Implement the function step_random_walk_20(x_coords,...

    please use python thanks will rate!! x + Run C Code Validate Implement the function step_random_walk_20(x_coords, Y_coords) below, which should take two arrays of equal length containing the x-andy- coordinates for some number of particles. We'll use a very simple random walk algorithm • For each particle, choose a random angle between 0 and 2 • The particle moves by 1 unit of distance in the direction given by d.o. It is displaced by (Ax, Ay) (cos, sino). We'll do...

  • programing C,already write part of code (a) Write a function print.array that receives an array of...

    programing C,already write part of code (a) Write a function print.array that receives an array of real numbers and the number of el stored in the array. This function must display the elements of the array in order with each one on a line by itself in a field width of 7 with two decimal places. (See sample output. Recall the format specifier would be "%7.21f"). (b) Sometimes we want to treat an array as a mathematical vector and compute...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT