title: IndexError: single positional indexer is out-of-bounds error while downloading data
body: <p>I am running a code to download data and saving them in local drive. However, I am getting above mentioned error message. Please note initially I have converted date in a different format and while saving them I get this error message.</p>
  
  <p>Can you please help me with this error?</p>
  
  <p>'''</p>
  
  <p>import quandl
  import os
  import pandas as pd
  import datetime as dt
  import glob</p>
  
  <p>if <strong>name</strong> == "<strong>main</strong>":</p>
  
  <pre><code>'Creating bucket to store missing data file.'
  data_missing = []
  New_date = []
  
  'Defining a path to save CSV files after downloading and also deleting all csv file at one go.'
  extension = 'csv'
  path = "F:/Tradepoint/MyMkt/"
  if not os.path.exists(path):
         os.mkdir(path)
  os.chdir(path)
  csv_count = [forma for forma in glob.glob('*.{}'.format(extension))]
  for csv_coun in range(len(csv_count)):
      os.remove(r"F:/Tradepoint/MyMkt/" + csv_count[csv_coun][0:])
  
  'Setting up quandl configuration, reading ticker list, setting up date for which data is going to get downloaded'
  quandl.ApiConfig.api_key = 'Hba3CzgNnEa2LMxR14FA'
  end_date = dt.date.today()
  diff_year = dt.timedelta(days=3650)
  start_date = end_date - diff_year
  stock_list = pd.read_csv(r"F:\Abhay_New\Abhay\Python\Project\SHARADAR_SF1.csv")
  
  'Looping through quandl website to download data and renaming them as per requirement.'
  for stock_lis in range(len(stock_list)):
      data = quandl.get_table('SHARADAR/SEP', date={'gte':start_date, 'lte':end_date}, ticker=stock_list.iloc[stock_lis])
      sort_by_date = data.sort_values('date')
      for sort_by_dat in range(len(sort_by_date['date'])):
          Date = dt.date.strftime(sort_by_date['date'][sort_by_dat],'%d-%m-%Y')
          New_date.append(Date)
      if len(data)&gt;1:
          Date = pd.Series(New_date).rename('Date').astype(str)
          OPEN = sort_by_date['open']
          HIGH = sort_by_date['high']
          LOW =  sort_by_date['low']
          CLOSE = sort_by_date['close']
          VOLUME = sort_by_date['volume']
          final_data = pd.concat([Date,OPEN,HIGH,LOW,CLOSE,VOLUME],axis=1)
          stk = stock_list.iloc[sort_by_dat][0]
          final_data.to_csv(str(path + stk + '.csv'), sep=',', index = False, header = False)
      else:
          data_missing.append(stock_list.iloc[sort_by_dat]) 
  </code></pre>
  
  <p>print(data_missing)</p>
  
  <p>'''</p>
  
  <p>Thanks,
  Abhay Dodiya</p>