NumPy Codes and import

 First open Anaconda, then launch the jupyter notebook.


Then create new python 3 file.


Here we will discuss NumPy arrays and codes.


Let's print an array.


Oh ! Was it easy ? Yes .It was.


Now we will import numpy and use that to assign the array to a variable, and some other things also will try ...





Here, I created an array . Then I imported NumPy as np . Then I used np to set the array to the variable arr.



2D array NumPy



There are 2 braces in the beginning so 2D array.3 rows 3 columns.



arrange is used to quickly generate an array in NumPy of certain condition or in normal as per above example.


link space

--------------:


here the third argument is considered as no of points as you want where as arrange take it as steps as you want.


identity matrix




randn() shows a standard normal distribution.


randn() in 2  Dimension



Printing random integer using randint()




max() for finding the highest number in the array and min() for the lowest number.

argmax() used to show the index of the max(highest) number from the array.



dtype() gives you the datatype.



If we don’t want to use numpy.random , we can declare it as an alias i.e. randint or enything elase.





#numpy

#python

#jupyternotebook

#anaconda

#datascience

Comments

Popular posts from this blog

Git Commands With Output Log

Java Interview Preparation (conceptual)

Java 8 Function Interface