0

i have an array a1 in numpy .when using the size function i have encountered two ways both are giving correct answer, but i dint understand the difference.

below is the code used:

import numpy as np

a1= np.array([1,2,3,4,5,6])

print(a1.size)

print(np.size(a1))

out put is : 6

Thanks in advance

0

1 Answer 1

1

There is no difference. a.size is a method call that executes np.prod(a.shape). While np.size(a) returns a.size.

Link to Method Docs
Link to np.size Code

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.