title: How to create a property of a subclassed pandas dataframe that acts like a column
body: <p>This may not be possible, or even a good idea but I wanted to see what options are available.</p>
  <p>I want to create a subclass of a DataFrame that has a column as a property. E.g.</p>
  <pre><code>import pandas as pd
  
  
  class DFWithProperties(pd.DataFrame):
      &quot;&quot;&quot;A DataFrame that definitely has an 'a' column.&quot;&quot;&quot;
  
      @property 
      def depends_on_a(self):
          return self[&quot;a&quot;] + 1
  
  df = DFWithProperties({&quot;a&quot;: [1,2,3,4]})
  </code></pre>
  <p>I can obviously access this property in a similar way to other columns with</p>
  <pre><code>df.depends_on_a
  </code></pre>
  <p>But I also want to be able to access this column with something like</p>
  <pre><code>df[&quot;depends_on_a&quot;]
  </code></pre>
  <p>or</p>
  <pre><code>df[[&quot;a&quot;, &quot;depends_on_a&quot;]]
  </code></pre>
  <p>Are there any neat tricks I can use here, or am I being too ambitious?</p>