#data-science-and-ml

1 messages · Page 423 of 1

naive cairn
#

please help me find out the tutorials or courses online that how to integrate all model ml into the web app or create my own ml from scratch. I will appreciate

viscid bridge
#
myArr = np.zeros(0)
hana= [1,34,45,64,342,57,345,234]
for i in range(0,4):
    myArr=np.append(hana,hana[i])
print(myArr)
#

i only want to add 1,34,45,64 to the array myArr but when i run this why does it adds all the value to the myArr array . Somebody help plze.

wooden sail
viscid bridge
#

can you give the correct syntax please

wooden sail
#

based on your code,

import numpy as np
myArr = np.zeros(0)
hana= [1,34,45,64,342,57,345,234]
for i in range(0,4):
    myArr=np.append(myArr,hana[i])
print(myArr)

but honestly this is not what you want to do. you'd really do this instead

import numpy as np
hana= [1,34,45,64,342,57,345,234]
myArr = hana[0:4]

with slice notation

#

oops i forgot to make the change in the first block of code. i fixed it now

viscid bridge
#

i'll give you that part of code as well just a sec

#
for i in range (0,688128):
    if flat_gt[i]==255:
        W_val_hs= np.append(flat_hs,[flat_hs[i]])
wooden sail
#

that has the same mistake

viscid bridge
#

so in this case how do i take only a specific set of value of i ?

viscid bridge
wooden sail
#

i'd do something like ```py
In [7]: W_val_hs = np.array([0, 100, 255, 255, 3, 255])

In [8]: hana = np.array([ 300, 12039, 43, 93, 123, 34 ])

In [9]: hana[ W_val_hs == 255 ]
Out[9]: array([43, 93, 34])

which is more general than slicing. so-called "fancy indexing", which is great with numpy because operations easily broadcast over arrays
lapis sequoia
#

pip install