title: In pandas, what's the difference between df['column'] and df.column?
body: <p>I'm working my way through Pandas for Data Analysis and learning a ton. However, one thing keeps coming up. The book typically refers to columns of a dataframe as <code>df['column']</code> however, sometimes without explanation the book uses <code>df.column</code>.</p>
  
  <p>I don't understand the difference between the two. Any help would be appreciated.</p>
  
  <p>Below is come code demonstrating the what I am talking about:</p>
  
  <pre><code>In [5]:
  
  import pandas as pd
  
  data = {'column1': ['a', 'a', 'a', 'b', 'c'], 
          'column2': [1, 4, 2, 5, 3]}
  df = pd.DataFrame(data, columns = ['column1', 'column2'])
  df
  
  Out[5]:
  column1 column2
  0    a   1
  1    a   4
  2    a   2
  3    b   5
  4    c   3
  5 rows × 2 columns
  </code></pre>
  
  <hr>
  
  <p><strong>df.column:</strong></p>
  
  <pre><code>In [8]:
  
  df.column1
  Out[8]:
  0    a
  1    a
  2    a
  3    b
  4    c
  Name: column1, dtype: object
  </code></pre>
  
  <hr>
  
  <p><strong>df['column']:</strong></p>
  
  <pre><code>In [9]:
  
  df['column1']
  Out[9]:
  0    a
  1    a
  2    a
  3    b
  4    c
  Name: column1, dtype: object
  </code></pre>