I recently started to use pandas but I had some confusion over it's pointer and "inplace" operation. Related posts can be found here: Pandas - inplace, view, copy confusion and Python Pandas - Understanding inplace=True
Suppose A is a data frame.
Here's what I read from the text.
A.drop(["col_name1"], axis=1, inplace=True)
#operated on A directly and drop the col_name1
B=A.drop(["col_name1"], axis=1 )
# return a copy of dropped value and assigned to B, thus B was not a pointor
However, if I type
B=A.drop(["col_name1"], axis=1, inplace=True)
will B be a pointer of A?
Further, when will the command .copy() be necessary? i.e. where we must use .copy() so that B was an extra copy but not a pointer.
B=A["col_names_n"].operation.copy()
Why does pandas use pointer so often? i.e. if I type the
B=1
A=B
A=2
print(B)
#then it would return 1
But pandas's default was to declare B as a pointer.