title: Pandas dataframe column names
body: <p>I have a pandas dataframe which I have collected from a MongoDB.</p>
  <p>The column names are a series of dates, ie. 4/7/20, 4/8/20, etc.</p>
  <p>What I want to do is find the most recent date which has a column name the same as the date, because I want to delete all other date columns before writing it to a PostgreSQL database.</p>
  <p>I was intending:</p>
  <ol>
  <li>Set a variable with today's date</li>
  <li>Loop through the column names comparing with today's date</li>
  <li>If exists, retain the variable name</li>
  <li>If it does not, reduce the date by 1 and check again until I get a match.</li>
  </ol>
  <p>I am trying to get a list of column names from the dataframe, but when I run</p>
  <pre><code>
      collection = client['DB_Name']['DB_Collection']
      
      df = collection.find()
      
      data_pandas = pd.DataFrame(list(df))
      
      index_list = list(data_pandas.index.values.tolist()) 
      
      today = date.today()
      
      today = today.strftime('X%m/X%d/%Y').replace('X0','X').replace('X','')
      
      print(df.columns)
  
  </code></pre>
  <p>I get an error:</p>
  <blockquote>
  <p>'Cursor' object has no attribute 'columns'</p>
  </blockquote>
  <p>The data frame looks fine from the IDE. What can I do to resolve this?</p>