title: what happens when I modify a pandas dataframe in the following way
body: <p>trying to understand this behavior (why it happens; and if it was intentional, then what was the motivation for it to be done this way)</p>
  
  <p>So I create a dataframe</p>
  
  <pre><code>np.random.seed(0)
  df = pd.DataFrame(np.random.random((4,2)))
  
  
            0         1
  0  0.548814  0.715189
  1  0.602763  0.544883
  2  0.423655  0.645894
  3  0.437587  0.891773
  </code></pre>
  
  <p>and I can reference columns like so</p>
  
  <pre><code>df.columns = ['a','b']
  df.a
            0
  0  0.548814
  1  0.602763
  2  0.423655
  3  0.437587 
  </code></pre>
  
  <p>I can even make, what I think is a new column</p>
  
  <pre><code> df.third = pd.DataFrame(np.random.random((4,1)))
  </code></pre>
  
  <p>but <code>df</code> is still</p>
  
  <pre><code>df
            0         1
  0  0.548814  0.715189
  1  0.602763  0.544883
  2  0.423655  0.645894
  3  0.437587  0.891773
  </code></pre>
  
  <p>however, <code>df.third</code> also exists (but i can't see it in my variable viewer in Spyder)</p>
  
  <pre><code>df.third
            0
  0  0.118274
  1  0.639921
  2  0.143353
  3  0.944669
  </code></pre>
  
  <p>if I wanted to add a third column, I'd have to do the following</p>
  
  <pre><code>df['third'] = pd.DataFrame(np.random.random((4,1)))
  
            a         b     third
  0  0.548814  0.715189  0.568045
  1  0.602763  0.544883  0.925597
  2  0.423655  0.645894  0.071036
  3  0.437587  0.891773  0.087129
  </code></pre>
  
  <p>So, my question is what's going on when I do df.third versus df['third']?</p>