What does on_delete do on Django models?

This is the behaviour to adopt when the referenced object is deleted. It is not specific to Django; this is an SQL standard. Although Django has its own implementation on top of SQL. (1) There are seven possible actions to take when such event occurs: CASCADE: When the referenced object is deleted, also delete the objects that have … Read more

Boolean Series key will be reindexed to match DataFrame index

Your approach will work despite the warning, but it’s best not to rely on implicit, unclear behavior. Solution 1, make the selection of indices in a_list a boolean mask: Solution 2, do it in two steps: Solution 3, if you want a one-liner, use a trick found here: The warning comes from the fact that the boolean vector df.a_col.isnull() is … Read more