100 Numpy Exercises - Hints, Discussions & Help

How do I get the documentation of some numpy function from command line?

help() will do the trick for you. For example, you want to check how to use the numpy.sort(), all you need to type in the command line is help(numpy.sort). Before then, you need to import numpy before hand, and if you import numpy with alias, say import numpy as np, you then need to type help(np.sort).

Hope this helps.

You can see it as the first part before the comma is for row and 2nd is column.

https://brainly.in/question/8978024 this might help.

Hi All,

I am struggling to understand the concept behind the below result,

Can any on e help with this ?

print(sum(range(5),-1))
from numpy import *
print(sum(range(5),-1))

Output : 9 and 10

Use just want to write the answer of the following commands.

Thanks aakash for this great exercises this will help us to get into numpy.

  1. Print the numpy version and the configuration (★☆☆) ??
    which version he is taking about ?

Where to post the 100 numpy exercises sir

why 0.3 == 3*0.1 gives false result

You do not turn this in; it is simply for your education and to become familiar with NumPy

It is because of the way that digits are represented in binary, I believe. It technically IS equivalent, however the bit representations are not the same.

Does below code make sense to get indices of non-zero entries in a vector?

arr1=np.array([1,2,0,0,4,0])
null_arr=np.zeros((6))

compare=(arr1==null_arr)

for i in range(len(compare)):
if compare[i] ==False:
print(i)

They are asking the numpy version you are using!
try writing…

import numpy as np
np.version.version

it will print out the version!

Hello guys, been working on the 100 numpy exercises.
I am currently at no. 51 and will most likely keep working on it until the end.
I hope these help somebody. Cheers

1 Like

I’ve been continuing to work on the 100 Numpy exercises and #29 seemed a lot harder to me than the one star indicated. It asked us to round away from zero and as far as I can tell, there are no built-in Numpy functions that will do that. This is what I ended up with, however, I am wondering if there was something that I missed with this exercise?

2 Likes

You can take the ceiling of absolute values while preserving the sign of the original value.

print(np.copysign(np.ceil(np.abs…)))

1 Like

How to write the code for print the numpy version and configuration?

Most python modules have a variable named __version__ which you can print to see what version is installed. The numpy module has a utility routine for showing the config which you can find in the documentation at https://numpy.org/doc/stable/reference/routines.html

It works. However, you may skip the use of null_arr and compare, and just simply compare each element of the array arr1 against 0 (zero).