How NumPy works

There are texts similar to wine or dynamite: over the years they do not age, but, on the contrary, acquire weight and significance. Today, for the start of the flagship course on Data Science, we decided to share the translation of the visual tutorial about NumPy in 2019, after reading which even a person who is not too close to math will understand how this Python library works. If you don't want to explain NumPy for a long time, but you still have to do it, bookmark the article and it will save you time.






NumPy — , Python. . Python (, scikit-learn, SciPy, pandas tensorflow) NumPy . NumPy .





NumPy, (, , .) .





[. . — , ]:





pip install numpy
      
      



Python, :





import numpy as np
      
      



NumPy (ndarray) NumPy Python np.array(). Python , :





, NumPy . NumPy , ones(), zeros() random.random(). , :





.





NumPy . data ones:





(. . ) : data + ones:





? , . , . :





, ( -). , , . data * 1.6:





NumPy , ! , .





NumPy [ " ", Python ] , Python:





— :





, (min, max sum) , mean ( ), prod ( ), std ( ), .





?

. NumPy .





NumPy Python, :





np.array([[1,2],[3,4]])
      
      



(ones(), zeros() random.random()) , , , :





, (+-*/). NumPy :





, , (, ), NumPy :





. NumPy dot():





, , "" . :











:





, :





, axis:





. () , . NumPy T:





. , , . NumPy reshape(). . -1, NumPy :





?

NumPy . NumPy n- (ndarray, N-Dimensional Array).





NumPy:





: , NumPy , . n- NumPy , , — . , np.ones((4,3,2)) :





array([[[1., 1.],
        [1., 1.],
        [1., 1.]],

       [[1., 1.],
        [1., 1.],
        [1., 1.]],

       [[1., 1.],
        [1., 1.],
        [1., 1.]],

       [[1., 1.],
        [1., 1.],
        [1., 1.]]])

      
      



, ? NumPy.





NumPy , . NumPy Python. , , , :





NumPy :





, NumPy , predictions labels (, ). , :





predictions labels . , n 3. :





:





:





.





, , , ( , , ... . .). n- :









  • , , . . Python pandas dataframe, NumPy .









  • — . — , . CD- 44 100 , -32767 32768. , WAVE- CD-, NumPy 10 * 44100 = 441000 . ? NumPy ( audio) audio[:44100]. :





NumPy (, ).









  • — ( x ).





  • - ( ), ( 0 () 255 ()). 10 x 10 ? NumPy : image[:10,:10].





:





  • , , . ( ). , : ( x x 3).









. ( , ) ( ). , :





“Have the bards who preceded me left any theme unsung?” ( - ?)





. ( 71290 ):





( , ):





:





. / ( 50- word2vec):





, NumPy [embedding_dimension x sequence_length]. , . , , ( ). reshape(). BERT, , : [batch_size, sequence_length, embedding_size].





, . , , ( ).





, , , , , . , ).





Data Science . , , — , , . , , , , Data Science.





, :





  • Data Analyst





  • Data Engineering









  • Fullstack- Python





  • Java-





  • QA- JAVA





  • Frontend-









  • C++





  • Unity





  • -





  • iOS-





  • Android-









  •  Machine Learning





  • «Machine Learning  Deep Learning»





  • « Data Science»





  • «  Machine Learning Data Science»





  • «Python -»





  • «   »





  •  





  •  DevOps








All Articles