# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import numpy as np

mylist=[1,2,3]

type(mylist)

np.array(mylist)

type(mylist)

mylist=[[1,2,3],[4,5,6],[7,8,9]]

np.array(mylist)

mymatrix=np.array(mylist)

mymatrix.shape

np.arrange(0,10)

np.arange(0,10)

np.arange(0,10,3)

np.zeros(5)

np.zeros(4,10)

np.zeros((4,10))

np.ones((5,4))

np.ones((5,4)) + 2

[1,1,1,1] *6

np.linspace(0,10,3)

np.linspace(0,10,20)

np.eye(5)

np.eye(4)

np.eye(4.4)

np.random.rand(5,5)

np.random.rand(3)

np.random.randn(10)

np.random.randn(1)

np.random.randint(1,100,10)

np.random.seed(555)
np.random.rand(4)

np.random.seed(42)
np.random.rand(4)

arr=np.arange(25)

arr

ranarr=np.random.randint(0,50,10)

ranarr

arr.reshape(5,5)

ranarr.min()

# + active=""
#
# -

ranarr

# + active=""
# ranarr.max()
# -

ranarr.max()

ranarr.max()

ranarr.argmax()

ranarr.argmin()

ranarr.dtype

arr=np.arange(0,11)

arr

arr[:5]

arr[0:5]

arr[6:]

arr+100

arr/100

arr

arr ** 2

arr

slice_of_arr=arr[0:6]

slice_of_arr

slice_of_arr[:]=99

slice_of_arr

arr

arr_copy=arr.copy()

arr_copy[:]=1000

arr_copy

arr

arr_2d=np.array([[5,10,15],[20,35,30],[35,40,45]])

# + active=""
#
# -

arr_2d

# + active=""
#
# -

arr_2d.shape

arr_2d[1]

# + active=""
#
# -

arr_2d[1][1]

arr_2d[1,1]

arr_2d[2,1]

arr_2d[:2]

arr_2d[:2,1:]

arr=np.arange(1,11)

arr

arr>4

bool_arr=arr>4

bool_arr

arr[bool_arr]

arr[arr>4]

arr[arr<=6]

arr=np.arange(0,10)

arr

1/arr

arr/arr

np.sqrt(arr)

np.log(arr)

    arr.sum()



arr.mean()

arr_2dw=np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12]])

arr_2dw

arr_2dw.shape

arr_2dw.sum()

arr_2dw.sum(axis=0)

arr_2dw.sum(axis=1)















































StarcoderdataJupyterScriptsDedupFiltered