Hello Krish, I think the whole concept relies on the following points. = -> in 1d or 2d creates an object of the same memory location. Changes reflect list.copy() in 1d -> copies the value into new object. Changes do not reflect list.copy() in 2d -> copies the object in a object into new object. Changes reflect copy.deepcopy and copy.copy() works for 2d only. copy.deepcopy() -> Creates new object and inserts copy of the objects. Changes do not reflect copy.copy() - > Creates new object and inserts the original objects. Changes reflect In short, we need to see if we are putting copy/original objects.
One tutor explained this for 1.5 Hr. Understood nothing.. This video is much much better than that's guy's boring explanation.. Very clear and very helpful.. Learnt the essence in this 12 minutes
I feel you could have shown visuals on the memory allocation for the nested lists part. The whole point as I inferred from your video is that if you have a shallow copy it will allocate space in memory for two lists but the lists will be pointing to the same items, whereas if you do it with a deep copy then new objects will be created and that's why they will be independent like that. Am I right? I just think you didn't stress this point as well as you could have.
A list is mutable which means we can change any element in it but it will refer to same memory location.With = sign both list refer to same memory location.With copy() both list refer to different memory location.With copy.deepy() both list as well as inside lists in them refer to different memory location. Simple rule if two list refer to different memory location even though they contain same element s ,they will not get affected by one another.
This is what I understand : (If we create a nested list and make a shallow copy of it , and then we change the original list then the shallow copy list will not be changed but if we change the object that is inside the original list's list that is referring to the shallow copy then the change will also be reflected in shallow copy )
Summary: 1a) Deep copy: multiple 1 to 1 relationships from variable to memory. 1b) Shallow Copy: many-to-one relationships from variables to memory. 2) In a normal list, shallow copy behaves as deep copy whereas in a nested list, shallow copy doesn't behave as deep copy.
Hi Krish your channel is very helpful for all DS aspirants like me. Request you to make a video on the system configurations needed for deep learning projects and is it better to buy system or assemble myself as buying a laptop is out of my budget. I am looking to buy a system for my deep.learning projects. Thank you
This was a great explanation it was very clear. However, is it possible to add an example of when you would use either shallow copy or deep copy. I'm not sure when these things would get used.
I had a nested list which I wanted to copy using "=" and it didn't work, so deep copy is useful, however I can also make a loop that does the same thing
I'm just a beginner to Python but still it was soo clear to me. Thank You for explaining it soo easily
Great Explanation now everything is clear, and we can also check reference no by using id(lst1) and id(lst2) it show the reference number. 🙂👍
Hello Krish, I think the whole concept relies on the following points.
= -> in 1d or 2d creates an object of the same memory location. Changes reflect
list.copy() in 1d -> copies the value into new object. Changes do not reflect
list.copy() in 2d -> copies the object in a object into new object. Changes reflect
copy.deepcopy and copy.copy() works for 2d only.
copy.deepcopy() -> Creates new object and inserts copy of the objects. Changes do not reflect
copy.copy() - > Creates new object and inserts the original objects. Changes reflect
In short, we need to see if we are putting copy/original objects.
One tutor explained this for 1.5 Hr. Understood nothing.. This video is much much better than that's guy's boring explanation.. Very clear and very helpful.. Learnt the essence in this 12 minutes
Simple and Clear to the point .
I feel you could have shown visuals on the memory allocation for the nested lists part.
The whole point as I inferred from your video is that if you have a shallow copy it will allocate space in memory for two lists but the lists will be pointing to the same items, whereas if you do it with a deep copy then new objects will be created and that's why they will be independent like that. Am I right?
I just think you didn't stress this point as well as you could have.
In Python 1000 Same List Create 1000 new Memory location... Python can't take risk with mutable objects.
This was very clear and concise, thank you so much!
Thanks a lot bhai. ye shallow copy aur deepcopy ka concept hi smjh nai aa raha tha bht time se.
A list is mutable which means we can change any element in it but it will refer to same memory location.With = sign both list refer to same memory location.With copy() both list refer to different memory location.With copy.deepy() both list as well as inside lists in them refer to different memory location.
Simple rule if two list refer to different memory location even though they contain same element s ,they will not get affected by one another.
Great explanation, now I am clear with the topic of shallow and deep copy . Thank you so much 🙏
This is what I understand :
(If we create a nested list and make a shallow copy of it , and then we change the original list then the shallow copy list will not be changed but if we change the object that is inside the original list's list that is referring to the shallow copy then the change will also be reflected in shallow copy )
Thanks for the explanation..you really emphasised on the point it needed the most!
previous i just ignore this topic because i thought it was big and complicated but i understand how simple this.. Thank You Bro :-)
You made it very easy to understand.
Thank you for explaining it so easily!
The explanation was vary clear. Thank you so much for your time.
Thank you.. Your explanation is so clear and understandable
Your are Great !! helping the community
love uh this is the main concept which i wanna get thank uh thank uh soo much
Fabulous explanation of a very complicated topic of Python....
this 12 minutes is better than 2 hours lecturer
Absolutely
Very very true!!!
Yep 100%
well explained!!
so helpful and clear! thank you :)
Very helpful and clear! thanks!!
Sir can we call the copy (using assignment operator),a shallow copy
Nice explanation sir
Thanks for ther vedio, it was very clear.
i ma mechanical engineer but watching this i can clearly understand excellent way of teaching
Very nice explanation, I was confused but this video helps a lot! Thanks😊
print("Very well explained...")
Very well explained. Thank you...
Thank s for this great explaination
Very well explanated
Great explanation
Thanks
Thank you so much well easily explaiend
Thank you so much!
Very well explained
Thank you so much, you saved me several hours 🤗
Sir, could you please do complete nosql course series from intermediate to advanced?
goodmorning sir
Great explanation. Thanks.
Excellent explanation
Summary:
1a) Deep copy: multiple 1 to 1 relationships from variable to memory.
1b) Shallow Copy: many-to-one relationships from variables to memory.
2) In a normal list, shallow copy behaves as deep copy whereas in a nested list, shallow copy doesn't behave as deep copy.
Thank you so much this was a very good explanation
thanks!, very clear explanation
Started learning python today ✌️
Hi Krish your channel is very helpful for all DS aspirants like me. Request you to make a video on the system configurations needed for deep learning projects and is it better to buy system or assemble myself as buying a laptop is out of my budget. I am looking to buy a system for my deep.learning projects. Thank you
excellent explanation!!!
This was a great explanation it was very clear. However, is it possible to add an example of when you would use either shallow copy or deep copy. I'm not sure when these things would get used.
I had a nested list which I wanted to copy using "=" and it didn't work, so deep copy is useful, however I can also make a loop that does the same thing
very great series thank you sir
So Helpful!
👏👏TYSM
Does this even apply to dataframes?
7:23
thank you, sir
THANKS A LOT SIR
I always thought python had "deep copy" set by default since it worked with non iterables but then I encountered a strange bug which brought me here
Really helpful,
Bro please explain how to change my career path into cloud computing
Currently i am working as uxdesigner
Please do a video on that 🙏🙏
Can I use .copy(deep=True) for deep copy
Amazing thank you
Thanks a lot!
Hello Sir, if we want to reach out for you how do we reach
What is difference between deep copy and =
(=) simply referred the memory location
(copy) make a new memory of item but
Sir can you make video on business analytics
Sir plz do a multithread concepts in python
@Krish Too may ads in the vedio is spoiling the flow
concept ok. but whats the use of it ?
maza aagaya bhai
keep it up
Ty bhaiya
bhai jo jis doubt ko le k aaega wo waisa ka waisa he reh jaega iss video me
Спасибо!
I've blundered 3 hours why list have changed automatically before watching this video
nice
buyuksun hoca
👾😁👍
It can be explained in better way.
First
Full confused
8:58