Learn data science and machine learning by building real-world projects on Jovian

Sign up to execute **numpy-array-operations** and 150,000+ data science projects. Build your own projects and share them online!

Created 10 months ago

Assignment 2 - Numpy Array OperationsThis assignment is part of the course "Data Analysis with Python: Zero to Pandas". The objective of this assignment is to develop a solid understanding of Numpy array operations. In this assignment you will:

- Pick 5 interesting Numpy array functions by going through the documentation: https://numpy.org/doc/stable/reference/routines.html
- Run and modify this Jupyter notebook to illustrate their usage (some explanation and 3 examples for each function). Use your imagination to come up with interesting and unique examples.
- Upload this notebook to your Jovian profile using
`jovian.commit`

and make a submission here: https://jovian.ml/learn/data-analysis-with-python-zero-to-pandas/assignment/assignment-2-numpy-array-operations- (Optional) Share your notebook online (on Twitter, LinkedIn, Facebook) and on the community forum thread: https://jovian.ml/forum/t/assignment-2-numpy-array-operations-share-your-work/10575 .
- (Optional) Check out the notebooks shared by other participants and give feedback & appreciation.
The recommended way to run this notebook is to click the "Run" button at the top of this page, and select "Run on Binder". This will run the notebook on mybinder.org, a free online service for running Jupyter notebooks.

Try to give your notebook a catchy title & subtitle e.g. "All about Numpy array operations", "5 Numpy functions you didn't know you needed", "A beginner's guide to broadcasting in Numpy", "Interesting ways to create Numpy arrays", "Trigonometic functions in Numpy", "How to use Python for Linear Algebra" etc.

NOTE: Remove this block of explanation text before submitting or sharing your notebook online - to make it more presentable.

Write a short introduction about Numpy and list the chosen functions.

- function 1
- function 2
- function 3
- function 4
- function 5

The recommended way to run this notebook is to click the "Run" button at the top of this page, and select "Run on Binder". This will run the notebook on mybinder.org, a free online service for running Jupyter notebooks.

In [1]:

`!pip install jovian --upgrade -q`

In [2]:

`import jovian`

In [ ]:

`jovian.commit(project='numpy-array-operations')`

```
[jovian] Attempting to save notebook..
```

Let's begin by importing Numpy and listing out the functions covered in this notebook.

In [1]:

`import numpy as np`

In [ ]:

```
# List of functions explained
function1 = np.concatenate # (change this)
function2 = ???
function3 = ???
function4 = ???
function5 = ???
```

Add some explanation about the function in your own words

In [14]:

```
# Example 1 - working (change this)
arr1 = [[1, 2],
[3, 4.]]
arr2 = [[5, 6, 7],
[8, 9, 10]]
np.concatenate((arr1, arr2), axis=1)
```

Out[14]:

```
array([[ 1., 2., 5., 6., 7.],
[ 3., 4., 8., 9., 10.]])
```

Explanation about example

In [4]:

```
# Example 2 - working
???
```

Explanation about example

In [15]:

```
# Example 3 - breaking (to illustrate when it breaks)
arr1 = [[1, 2],
[3, 4.]]
arr2 = [[5, 6, 7],
[8, 9, 10]]
np.concatenate((arr1, arr2), axis=0)
```

```
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-15-3386a3db1c34> in <module>
6 [8, 9, 10]]
7
----> 8 np.concatenate((arr1, arr2), axis=0)
<__array_function__ internals> in concatenate(*args, **kwargs)
ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 2 and the array at index 1 has size 3
```

Explanation about example (why it breaks and how to fix it)

Some closing comments about when to use this function.

In [23]:

`jovian.commit()`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/numpy-array-operations" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/numpy-array-operations
```

Add some explanations

In [ ]:

```
# Example 1 - working
???
```

Explanation about example

In [ ]:

```
# Example 2 - working
???
```

Explanation about example

In [ ]:

```
# Example 3 - breaking (to illustrate when it breaks)
???
```

Explanation about example (why it breaks and how to fix it)

Some closing comments about when to use this function.

In [32]:

`jovian.commit()`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/numpy-array-operations" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/numpy-array-operations
```

Add some explanations

In [ ]:

```
# Example 1 - working
???
```

Explanation about example

In [ ]:

```
# Example 2 - working
???
```

Explanation about example

In [ ]:

```
# Example 3 - breaking (to illustrate when it breaks)
???
```

Explanation about example (why it breaks and how to fix it)

Some closing comments about when to use this function.

In [25]:

`jovian.commit()`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/numpy-array-operations" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/numpy-array-operations
```

Add some explanations

In [ ]:

```
# Example 1 - working
???
```

Explanation about example

In [ ]:

```
# Example 2 - working
???
```

Explanation about example

In [ ]:

```
# Example 3 - breaking (to illustrate when it breaks)
???
```

Explanation about example (why it breaks and how to fix it)

Some closing comments about when to use this function.

In [26]:

`jovian.commit()`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/numpy-array-operations" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/numpy-array-operations
```

Add some explanations

In [ ]:

```
# Example 1 - working
???
```

Explanation about example

In [ ]:

```
# Example 2 - working
???
```

Explanation about example

In [ ]:

```
# Example 3 - breaking (to illustrate when it breaks)
???
```

Explanation about example (why it breaks and how to fix it)

Some closing comments about when to use this function.

In [27]:

`jovian.commit()`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/numpy-array-operations" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/numpy-array-operations
```

Add some explanations

In [ ]:

```
# Example 1 - working
???
```

Explanation about example

In [ ]:

```
# Example 2 - working
???
```

Explanation about example

In [ ]:

```
# Example 3 - breaking (to illustrate when it breaks)
???
```

Explanation about example (why it breaks and how to fix it)

Some closing comments about when to use this function.

In [28]:

`jovian.commit()`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/numpy-array-operations" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/numpy-array-operations
```

Summarize what was covered in this notebook, and where to go next

Provide links to your references and other interesting articles about Numpy arrays:

- Numpy official tutorial : https://numpy.org/doc/stable/user/quickstart.html
- ...

In [30]:

`jovian.commit()`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/numpy-array-operations" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/numpy-array-operations
```

In [ ]:

` `