title: How to make pandas dataframe constant and use it outside of function?
body: <p>I am making an API call to coinmarketcap.com and convert JSON object that is being returned to pandas data frame. I was wondering if there any way to store the data frame columns as constant and use it outside of the function?</p>
  
  <pre><code>def get_cmc_supply():
      url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest'
      parameters = {
        'start': '13',
        'limit': '13',
        'convert': 'USD',
      }
      header = {
        'Accepts': 'application/json',
        'X-CMC_PRO_API_KEY': '###################',
      }
  
      data = requests.get(url, headers = header,timeout=10).json()
  
      records = []
  
      for item in data["data"]:
          records.append(
              {
                  "name": item['symbol'],
                  "supply": item['circulating_supply'],
              }
          )
  
      df = pd.DataFrame.from_records(records)
      df = df.rename(columns={"name":"symbol"})
      df = df.set_index('symbol')
      return df
  
  get_cmc_supply()
  </code></pre>
  
  <p>How can I store <code>df</code>, so I can access it outside of the function without calling the get_cmc_supply() function again and getting a new supply data from API call?</p>