title: how to convert a customized data frame into a list?
body: <p>So I wish to convert a customized data frame into a list for exporting and here is my current code building up to it:</p>
  <pre><code>import math
  cwd = os.path.abspath('') 
  files = os.listdir(cwd)  
  df = pd.DataFrame()
  for file in files:
      if file.endswith('.XLSX'):
          df = df.append(pd.read_excel(file), ignore_index=True)
  
  df = df.where(df.notnull(), None)
  array = df.values.tolist()
  print(array)
  
  class Item():
      def has_all_properties(self):
          return bool(self.__name and not math.isnan(self.__cost) and self.__gender and self.__prime)
      def clean(self):
          return bool(self.__name and self.__cost &lt;20 and self.__gender == &quot;male&quot; and self.__prime == &quot;yes&quot;)
      
      def __init__(self, name, cost, gender, prime):
          self.__name = name
          self.__cost = cost
          self.__gender = gender
          self.__prime = prime
  
      def __repr__(self):
          return f&quot;Item({self.__name},{self.__cost},{self.__gender},{self.__prime})&quot;
  
  mylist = [Item(*k) for k in array if k[0] and k[1] and k[2] and k[3]]
  #print(mylist)
  
  filtered = filter(Item.has_all_properties, mylist)
  clean = filter(Item.clean, filtered)
  result = list(clean)
  
  #result = result['coln'][idx]
  
  print(result)
  </code></pre>
  <p>The mylist I obtained from the excels data using the class function looks something like this:</p>
  <pre><code>mylist =    [Item(book,9.0,male,yes), 
               Item(paint,14.0,male,no), 
               Item(pen,5.0,female,nan), 
               Item(phone case,9.0,nan,no), 
               Item(headphone,40.0,male,yes), 
               Item(coat,nan,male,no),
               Item(comic,15.0,male,yes), 
               Item(nan,15.0,male,no)
               ... and so on]
  </code></pre>
  <p>and after all the data cleaning, the result would look something like this:</p>
  <pre><code>  result =  [Item(book,9.0,male,yes), 
               Item(comic,15.0,male,yes),
               ... and so on]
  </code></pre>
  <p>Now I wish to take the items out of the <code>result</code> and make it into an 2d list and get something like this:</p>
  <pre><code>list = [(book, 9.0,male,yes),
          (comic, 15.0,male,yes),
           ... and so on]
  </code></pre>
  <p>I am aware that using pandas all the way works, but I wish to explore the class function so I did not do that.</p>
  <p>Can you give me some advice, thank you in advance.</p>