Question

Python NumPy Create an NumPy array and a print statement that will produce the following output...

Python NumPy

Create an NumPy array and a print statement that will produce the following output when your code runs:

array: ['1' '2'] and its dtype is: |S1

What type is "s1"? (answer via a print statement in your code).

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

main.py

array=[1,2,3,4,5,6]
print 'array : ', array
print type(array)

Output:-

array :  [1, 2, 3, 4, 5, 6]
<type 'list'>
Add a comment
Know the answer?
Add Answer to:
Python NumPy Create an NumPy array and a print statement that will produce the following output...
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
  • PLEASE USE PYTHON*** 11.2 Create a numpy array with values 10, 11, ..., 49 and give...

    PLEASE USE PYTHON*** 11.2 Create a numpy array with values 10, 11, ..., 49 and give it to a variable named var. Then print out var

  • Problem 2 using Python NumPy and Pandas libraries NOTES: Import NumPy as np and Pandas as...

    Problem 2 using Python NumPy and Pandas libraries NOTES: Import NumPy as np and Pandas as pd Given the following piece of code to create a NumPy array, anIntArray: anIntArray = np.random.randint(5, 72, 48) Add Python code to convert this array into a Pandas series and then extract values stored at the positions 0, 5, 10, 15, 20 of the series.

  • 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)

  • Python...I don't know what is wrong with my code: import numpy as np from mpi4py import...

    Python...I don't know what is wrong with my code: import numpy as np from mpi4py import MPI array= [14,175, 15,055, 16,616, 17,495, 18,072, 19,390] array1,array2= array[ : :2], array[1: :2] print (array1) print (array2) /////it should print array1 = [1,4175, 16,616,18,072] array2= [15,055, 17,495, 19,390]

  • need help with this python progam using numpy Create a 4x4 two dimensional array with numbers...

    need help with this python progam using numpy Create a 4x4 two dimensional array with numbers from 1 thru 16. show this then: Change the last element by dividing it in half. Show that the original array has changed. show this then: Set all values in row 2 to zero. Show the original array contains this change show this then: Set all values in column 1 to one. Shoe the original array contains this change. show this then: Display the...

  • Write in python The main goal of this file will be to produce a 2D numpy array that could serve a...

    write in python The main goal of this file will be to produce a 2D numpy array that could serve as a visual look-up table for the following length units: kilometers, miles, and nautical miles. The variable name for this array should be ltable (standing for length table). The look-up values will be dictated by values for kilometers that should go from 0 to 30 in half-kilometer increments (0, 0.5, 1, 1.5, ..., 28.5, 29, 29.5, 30). The kilometer (km)...

  • 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...

  • Python Help: Using the stock.py data, write a program that does the following: Create a NumPy...

    Python Help: Using the stock.py data, write a program that does the following: Create a NumPy array from the nasdaq list from stocks.py. Do the same with the other three lists from stocks.py. Thus, at the end of this tasks, you will have four NumPy arrays. Print out the type (that is, the object type, not the element type) of each array in #1 and the data type typecode of the elements in each array in #1. This task is...

  • 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...

  • D Question 12 1.5 pts Check the true statements about NumPy arrays: O A single instantiated NumPy array can store multi...

    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...

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