Why use pandas.DataFrame.copy() for column extraction
<p>I've recently seen this kind of code:</p>

<pre><code>import pandas as pd
data = pd.read_csv('/path/to/some/data.csv')
colX = data['colX'].copy()
data.drop(labels=['colX'], inplace=True, axis=1)
</code></pre>

<p>I know that, to make an explicit copy of an object, I need <code>copy()</code>, but in this case, when extracting and subsequent deletion of a colum, is there a good reason to use <code>copy()</code>?</p>

<p>@EdChum statet in the comments:</p>

<blockquote>
  <p>the user may want to separate that column from the main df, of course if the user just wanted to delete that column then taking a copy is pointless if their intention is to delete the column but for instance they didn't take a copy and instead took a reference then operations on that column may or may not affect the orig df if you didn't drop it.</p>
</blockquote>

python pandas