## Python Data Science Tutorial Index

Numpy can be abbreviated as Numeric Python, is a Data analysis library for Python that consists of multi-dimensional array-objects as well as a collection of routines to process these arrays. In this tutorial, you will be learning about the various uses of this library concerning data science.

NumPy is a linear algebra library for Python, and it is so famous and commonly used because most of the libraries in PyData's environment rely on Numpy as one of their main building blocks. Moreover, it is fast and reliable.

It is recommended that your system should have Python installed via Anaconda distribution (www.continuum.io or www.anaconda.com ) for making sure all underlying dependencies get sync up with use of conda install. The Python's standard distribution doesn't come with NumPy library module. So for installing Numpy, you have to go to command prompt (Windows users) or terminal (Mac users) and type the following:

```conda install numpy

pip install numpy```

In this chapter, you will be using numpy arrays. Numpy comes in two different flavors. These are:

• Vectors and
• Matrices

Here vectors are 1D (a one-dimensional array of elements), and matrices are 2D (two dimensional) array of elements. It is to be noted that matrices can also hold only either one row or one column as well.

### Numpy Operations and Features

Numpy allows developers to do the following operations:

• Shape manipulation and Fourier transformation
• Logical as well as mathematical operations
• Linear algebra operations using inbuilt functions

### Implement the Numpy Library

So for implementing different Python codes implementing numpy for data science you have to open Jupyter notebook. As you open Jupyter notebook for writing code, you will see this above interface and in the In[ ]: section you have to insert your script. The NumPy arrays will be the keyway of implementing the entire NumPy library. So let us start using NumPy.

``````my_dataList = [2, 4, 6]

import numpy as np

ar = np.array (my_dataList)

ar``````

Output:

``Out[ ]: array ( [2, 4, 6])``

It will return a one-dimensional array.

#### Another Code snippet

``````# assigning nested list, which is a 2D format
my_mat = [[1,2,3], [4,5,6], [7,8,9]]

# Cast the list variable to an array() and use the library np
np.array(my_mat)`````` You will notice the output will look something like this (in red):

Here is the output you can see a 2D array having three rows and three columns of values that were assigned earlier to the my_mat variable.
{"ft_lang_label":"__label__en","ft_lang_prob":0.89350134,"math_prob":0.7984798,"size":2452,"snap":"2023-40-2023-50","text_gpt3_token_len":554,"char_repetition_ratio":0.10498366,"word_repetition_ratio":0.0,"special_character_ratio":0.21818924,"punctuation_ratio":0.10822511,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9952689,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,6,null,6,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-23T07:35:52Z\",\"WARC-Record-ID\":\"<urn:uuid:f16f0941-4fe0-4e2f-b01f-11576ebcf94b>\",\"Content-Length\":\"42874\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:089261f6-856e-4f58-8f44-ea848ba76012>\",\"WARC-Concurrent-To\":\"<urn:uuid:4603aeaf-0458-4099-8fb0-879817c20293>\",\"WARC-IP-Address\":\"172.67.174.7\",\"WARC-Target-URI\":\"https://www.w3schools.in/python-data-science/introduction-to-numpy-library/\",\"WARC-Payload-Digest\":\"sha1:UTGFJASHE3I7JVG7TW5PIOCGVVXOZUQO\",\"WARC-Block-Digest\":\"sha1:TMTLJDZV4DTAKIUHZ5EQX4YZFXYV3AG5\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233506480.35_warc_CC-MAIN-20230923062631-20230923092631-00222.warc.gz\"}"}