DEV Community

Durga Pokharel
Durga Pokharel

Posted on

1 2

Day 42 Of 100DaysOfCode : Learn About Basic Of Numpy

This is my 42th day of 100Daysofcode and python. Today I did some assignment on my old courses regarding to the topic regular expression. Learned more about algorithm. Practiced some code which were I already wrote.

And at the end of the day I learned about basic of numpy. I enjoyed on it. Tomorrow I will continue to learn about the same topic.

some code

While study I learned numpy helps to effectively loading, storing and manipulating data in memory in python. Data come from wide range of formats, including collections of documents, collections of images, collections of sound clip, collection of numerical measurement or nearly anything else.

import numpy as np
value = np.random.randint(0,10,(2,3))
value
Enter fullscreen mode Exit fullscreen mode

Output is,

array([[6, 2, 7],
       [9, 9, 6]])
Enter fullscreen mode Exit fullscreen mode
value = np.random.randint(0,10,20)
value
Enter fullscreen mode Exit fullscreen mode
array([4, 8, 1, 6, 0, 8, 9, 4, 1, 6, 9, 7, 6, 3, 2, 9, 2, 7, 7, 2])
Enter fullscreen mode Exit fullscreen mode
value = np.random.rand(3,4)
value
Enter fullscreen mode Exit fullscreen mode
array([[0.91465555, 0.99841031, 0.55547019, 0.57226342],
       [0.96754427, 0.2398907 , 0.0672654 , 0.4947008 ],
       [0.48353768, 0.06300809, 0.13866248, 0.73626242]])
Enter fullscreen mode Exit fullscreen mode

x = np.array([1,2,3,4,5,6])
x<3
Enter fullscreen mode Exit fullscreen mode
array([ True,  True, False, False, False, False])
Enter fullscreen mode Exit fullscreen mode
x<=3
Enter fullscreen mode Exit fullscreen mode
array([ True,  True,  True, False, False, False])
Enter fullscreen mode Exit fullscreen mode
rng = np.random.RandomState(0)
x = rng.randint(10,size=(3,4))
x
Enter fullscreen mode Exit fullscreen mode
array([[5, 0, 3, 3],
       [7, 9, 3, 5],
       [2, 4, 7, 6]])
Enter fullscreen mode Exit fullscreen mode

Day 42 of #100DaysOfCode and #pythonlearning
* More about Regular Expression
* More About basic of Algorithm
* Learned about basic of Numpy#womenintech ,#100DaysofCode, #CodeNewbies ,#womenwhocode, #DEVCommunity pic.twitter.com/Dsadt6KEGv

— Durga Pokharel (@mathdurga) February 4, 2021

Top comments (2)

Collapse
 
nitinkatkam profile image
Nitin Reddy

You are now using one of the two libraries that Python is known for - numpy and pandas are part of every data scientist's toolkit. And, as you are a math genius, perhaps you can post a blog article about some uses that you see for it beyond descriptive statistics. :-)

Collapse
 
iamdurga profile image
Durga Pokharel

Thank you for the compliment but I am not genius . I am just beginning to learn these things.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay