We've covered NumPy creating Arrays🎉🎉🎉 Now we gonna look at NumPy Array indexing: =>Access Array elements =>Access 2-D =>Access 3-D =>Negative indexing Finally, with a easy questions 🫡 But if you've questions feel free to write in the comment sections
❤1
#Access array element
import numpy as np
num = np.array([2, 4, 5, 7])
print(num[0]) #access the first element:2
print(num[2] + num[3]) #Summation: 12
#Access 2-D array
import numpy as np
num = np.array([[2, 3, 4], [5, 1, 6]])
print(num[1, 2]) #3rd element on 2nd row so 6
#Access 3-D array
import numpy as np
num = np.array([[[1, 2, 3], [4, 5, 6], [7, 8, 9]]])
print(num[0, 0, 1]) #2
#Negative indexing
import numpy as np
num = np.array([[2, 4, 1], [3, 5, 6]])
print(num[1, -1]) #6
I'll give the deep clarifications on the 3-D cause it might be small trick😦
❤2
Guys sorry this night just I've decided to have some rest. & It's hard to study. Cause I got bad cough😒😮💨
🫡1
I've pinned the message so in todays we gonna focus on DSA. You know that we were learning some types of sorting techniques. we stopped on merge sort. now let's begin it 👉🏽QUICK SORT on learning.... be with me🙏
Here I take this example then try to do with quick sort: Look at it👇👇👇👇
In the next I'll do the implementations part. I was just try to understand this concept. Now I understand the trick, we use in Quick sort technique. 🎉🎉🎉
[3, -2, -1, 0, 2, 4, 1]
at the first i take
pivot 1:
3 > 1, -2 < 1, -1 < 1, 0 < 1, 2 > 1, 4 > 1
then elements smaller that 1 are -2, -1, 0
elements greater than 1 are 3, 2, 4
and then [-2,-1,0] 1 [3, 2, 4]
now what i've to do is to arrange elements smaller than 1 as a pivot take 0
pivot 0: -2 < 0, -1 < 0 They're ordered
Know elements up to 1 are ordered:[-2, -1, 0, 1]
the next is to sort elements right of 1: those are [3, 2, 4]
as a pivot take 4:
3 < 4, 2 < 4 : [3, 2] 4 []
and know take 2 as a pivot: 3 > 2: then [] 2 [3]
combine the process right of 1: ->>[2, 3, 4] Done
now combine the elements left of 1: [-2, -1, 0, 1]
COMBINE ALL OF THEM: [-2, -1, 0, 1, 2, 3, 4] done
I understand in this way
""""
compare numbers with pivot
group them
sort left
sort right
combine
Average time: O(n log n)
""""
In the next I'll do the implementations part. I was just try to understand this concept. Now I understand the trick, we use in Quick sort technique. 🎉🎉🎉
https://www.almabetter.com/bytes/cheat-sheet/python
Take a look, it's useful resource
Take a look, it's useful resource
How are you all🤝
I know that, I didn't share for u some topics in this channel.
I was busy with class.
Whatever no worries, am gonna arrange it.⚡️
I know that, I didn't share for u some topics in this channel.
I was busy with class.
Whatever no worries, am gonna arrange it.⚡️
Hey at this night am about to work on some project.
So stay tuned, And tommorow we'll keep learn numpy from where we stoped 👌
So stay tuned, And tommorow we'll keep learn numpy from where we stoped 👌
SamiTech Code pinned «#Access array element import numpy as np num = np.array([2, 4, 5, 7]) print(num[0]) #access the first element:2 print(num[2] + num[3]) #Summation: 12 #Access 2-D array import numpy as np num = np.array([[2, 3, 4], [5, 1, 6]]) print(num[1, 2]) #3rd element…»
Hey guys:🖐
Therefore now we learn about Numpy array slicing.👇
In this morning, I was designing the UI of project am working on it. So now let's continue to our learning. You know that we're discussing on numpy and we try to cover; why it's needed to learn numpy, numpy creating arrays, numpy array indexing. No worries I've pinned the text.
Therefore now we learn about Numpy array slicing.👇
Now am studying Numerical Analysis I think some of you know that. Since We are learning Machine Learning and programming, numerical analysis helps in:👇
Many ML libraries internally use numerical methods.🧑💻
Optimization algorithms,
Training ML models,
Scientific simulations,
Computer graphics &
Data science
Many ML libraries internally use numerical methods.🧑💻
🤩2