Dimension in python numpy

0 votes

I am new to python and its various libraries. Currently, I am learning numpy and want to know if there is any function which will return the dimension of my array. For example:

Import numpy as np

I want to know its dimensions whether it’s a 2-d array or not. I even use the shape function but that could not come to my use.

Apr 19, 2018 in Python by ana1504.k
• 7,890 points

1 answer to this question.

0 votes

Use the .shape to print the dimensions of the array.

import numpy as np

Output – (2,2)

answered Apr 19, 2018 by aayushi
• 750 points

Related Questions In Python

0 votes
1 answer

In NumPy how do I get the maximum of subsets? Python

You can use np.maximum.reduceat: >>> _, idx = np.unique(g, ...READ MORE

answered Nov 9, 2018 in Python by Nymeria
• 3,540 points
0 votes
1 answer

How to save Numpy array as image in python?

If you have matplotlib, you can do: import ...READ MORE

answered Nov 16, 2018 in Python by Nymeria
• 3,540 points
0 votes
1 answer
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,086 views
0 votes
0 answers
+2 votes
11 answers
0 votes
1 answer

Parse JSON in Python

import json data=json.loads(employee_data) print(data) READ MORE

answered Apr 26, 2018 in Python by aayushi
• 750 points