by
List the steps to create a 1D array and 2D array in NumPy?

1 Answer

0 votes
by

A one-dimensional array is created as follows: 

num=[1,2,3]

num = np.array(num)

print(“1d array : “,num) 

A two-dimensional array is created as follows: 

num2=[[1,2,3],[4,5,6]]

num2 = np.array(num2)

print(“\n2d array : “,num2)

Related questions

0 votes
    What are the steps to use shape for a 1D array, 2D array and 3D/ND array respectively in NumPy?...
asked Apr 24, 2021 in Technology by JackTerrance
0 votes
    How to dynamically allocate a 1D and 2D array in c?...
asked Jan 24, 2021 in Technology by JackTerrance
0 votes
    Which of the following function stacks 1D arrays as columns into a 2D array? (a) row_stack (b) ... questions and answers pdf, Data Science interview questions for beginners...
asked Oct 28, 2021 in Education by JackTerrance
0 votes
    I’ve Found A Bug in Scipy. What Do I Do?...
asked Apr 25, 2021 by JackTerrance
0 votes
    I have the 4D array, which is defined as follows: B = np.array( [[[[0.5000, 0.5625], [0.5000, ... loops and ideally one function call. Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    What is the difference between 1D, 2D and 3D convolutions in CNN? Please explain with examples. Select the correct answer from above options...
asked Jan 24, 2022 in Education by JackTerrance
0 votes
    Write a Numpy program to create an array to 10 zeros,10 ones,10 fives. Select the correct answer from above options...
asked Dec 12, 2021 in Education by JackTerrance
0 votes
    How do you create a 3D array in NumPy?...
asked Apr 24, 2021 in Technology by JackTerrance
0 votes
    import numpy as np from pint import UnitRegistry unit = UnitRegistry() Q_ = unit.Quantity a = 1.0 ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    How is the dynamic memory allocation in 1D array in C?...
asked Jan 24, 2021 in Technology by JackTerrance
0 votes
    Point out the wrong statement. (a) Each universal function takes array inputs and produces array outputs (b) Broadcasting ... input arguments are ndarrays (d) All of the mentioned...
asked Oct 7, 2021 in Technology by JackTerrance
0 votes
    Shown below is the input NumPy array. Delete column two and replace it with the new column given below....
asked Apr 24, 2021 in Technology by JackTerrance
0 votes
    I have a dataset that only contains y-values in one column. I want to insert a column of x- ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I have a numpy array (dtype bool) representing an array of bits. For example, the array np.array( ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I need to iterate through the elements in a numpy array so I can treat any zero elements separately. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
...