title: Initialize an Python instance using an existing method from another class
body: <p>I am interested to prepare a class object which can inherit the attributes from another class. However, the initialization should be done by using an existing method from another class. One can try:</p>
  
  <pre><code>import pandas as pd
  
  class Data():
      def __init__(self, file):
          self.df = pd.read_csv(file)
  
  if __name__ = "__main__":
      abc = Data("xyz.csv")
  </code></pre>
  
  <p>In this manner, the instance 'abc.df' will be a DataFrame instance which is initialized by using pandas.read_csv() method, reading the "xyz.csv" file. I wonder how one can implement the initialization such that the
  'abc' itself will be the DataFrame instance instead of 'abc.df'? It shall be something like</p>
  
  <pre><code>import pandas as pd
  
  class Data():
      def __init__(self, file):
          self = pd.read_csv(file) # self has all the attributes of a DataFrame instance
  
  if __name__ = "__main__":
      abc = Data("xyz.csv")
  </code></pre>
  
  <p>Of course, this won't work.</p>
  
  <p>Edit: I found a relevant discussion on this <a href="https://stackoverflow.com/questions/22155951/how-to-subclass-pandas-dataframe">How to subclass Pandas.DataFrame</a>. However, I am still curious whether there is a way to create an instance by using the existing method of another instance. </p>