title: Pandas Dataframe - RemoteDataError - Python
body: <p>I'm trying to pull data from yahoo finance. </p>
  
  <p>Here is the error I'm getting:</p>
  
  <pre><code>File "banana.py", line 35, in &lt;module&gt;
      data = web.DataReader(ticker, "yahoo", datetime(2011,1,1), datetime(2015,12,31))
    File "C:\Users\ll\Anaconda2\lib\site-packages\pandas_datareader\data.py", line 94, in DataReader
      session=session).read()
    File "C:\Users\ll\Anaconda2\lib\site-packages\pandas_datareader\yahoo\daily.py", line 77, in read
      df = super(YahooDailyReader, self).read()
    File "C:\Users\ll\Anaconda2\lib\site-packages\pandas_datareader\base.py", line 173, in read
      df = self._read_one_data(self.url, params=self._get_params(self.symbols))
    File "C:\Users\ll\Anaconda2\lib\site-packages\pandas_datareader\base.py", line 80, in _read_one_data
      out = self._read_url_as_StringIO(url, params=params)
    File "C:\Users\ll\Anaconda2\lib\site-packages\pandas_datareader\base.py", line 91, in _read_url_as_StringIO
      response = self._get_response(url, params=params)
    File "C:\Users\ll\Anaconda2\lib\site-packages\pandas_datareader\base.py", line 117, in _get_response
      raise RemoteDataError('Unable to read URL: {0}'.format(url))
  pandas_datareader._utils.RemoteDataError: Unable to read URL: http://ichart.finance.yahoo.com/table.csv
  </code></pre>
  
  <p>The error shows up when I read from a .csv file instead of a list of tickers:</p>
  
  <p>This works: </p>
  
  <pre><code>for ticker in ['MSFT']:
  </code></pre>
  
  <p>This doesn't: </p>
  
  <pre><code>input_file = open("testlist.csv", 'r')
  for ticker in input_file: 
  </code></pre>
  
  <p>I've even put in exceptions (see below) but still not working:</p>
  
  <pre><code>    except RemoteDataError:
          print("No information for ticker '%s'" % t)
          continue
  
      except IndexError:
          print("Something went wacko for ticker '%s', trying again..." % t)
          continue
  
      except Exception, e:
          continue
  
      except:
          print "Can't find ", ticker
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>from datetime import datetime
  from pandas_datareader import data, wb
  import pandas_datareader.data as web
  import pandas as pd
  from pandas_datareader._utils import RemoteDataError
  import csv
  import sys 
  import os
  
  class MonthlyChange(object):
      months = { 0:'JAN', 1:'FEB', 2:'MAR', 3:'APR', 4:'MAY',5:'JUN', 6:'JUL', 7:'AUG', 8:'SEP', 9:'OCT',10:'NOV', 11:'DEC' }
  
  def __init__(self,month):
      self.month = MonthlyChange.months[month-1]
      self.sum_of_pos_changes=0
      self.sum_of_neg_changes=0
      self.total_neg=0
      self.total_pos=0
  def add_change(self,change):
      if change &lt; 0:
          self.sum_of_neg_changes+=change
          self.total_neg+=1
      elif change &gt; 0:
          self.sum_of_pos_changes+=change
          self.total_pos+=1
  def get_data(self):
      if self.total_pos == 0:
          return (self.month,0.0,0,self.sum_of_neg_changes/self.total_neg,self.total_neg)
      elif self.total_neg == 0:
          return (self.month,self.sum_of_pos_changes/self.total_pos,self.total_pos,0.0,0)
      else:
          return (self.month,self.sum_of_pos_changes/self.total_pos,self.total_pos,self.sum_of_neg_changes/self.total_neg,self.total_neg)
  
  input_file = open("Companylistnysenasdaq.csv", 'r')
  
  for ticker in input_file:  #for ticker in input_file:
  
  
  print(ticker)
  data = web.DataReader(ticker, "yahoo", datetime(2011,1,1), datetime(2015,12,31))
  data['ymd'] = data.index
  year_month = data.index.to_period('M')
  data['year_month'] = year_month
  first_day_of_months = data.groupby(["year_month"])["ymd"].min()
  first_day_of_months = first_day_of_months.to_frame().reset_index(level=0)
  last_day_of_months = data.groupby(["year_month"])["ymd"].max()
  last_day_of_months = last_day_of_months.to_frame().reset_index(level=0)
  fday_open = data.merge(first_day_of_months,on=['ymd'])
  fday_open = fday_open[['year_month_x','Open']]
  lday_open = data.merge(last_day_of_months,on=['ymd'])
  lday_open = lday_open[['year_month_x','Open']]
  
  fday_lday = fday_open.merge(lday_open,on=['year_month_x'])
  monthly_changes = {i:MonthlyChange(i) for i in range(1,13)}
  for index,ym, openf,openl in fday_lday.itertuples():
      month = ym.strftime('%m')
      month = int(month)
      diff = (openf-openl)/openf
      monthly_changes[month].add_change(diff)
  changes_df = pd.DataFrame([monthly_changes[i].get_data() for i in monthly_changes],columns=["Month","Avg Inc.","Inc","Avg.Dec","Dec"])
  
  
  
  
  t = ticker.strip()                                       
  j = 0
  while j &lt; 13:
  
      try:
          if len(changes_df.loc[changes_df.Inc &gt; 2,'Month']) != 0:
              print ticker
              print ("Increase Months: ")
              print (changes_df.loc[changes_df.Inc &gt; 2,'Month'])
  
          if len(changes_df.loc[changes_df.Dec &gt; 2,'Month']) != 0:
              print ticker
              print ("Decrease Months: ")
              print (changes_df.loc[changes_df.Dec &gt; 2,'Month'])
  
          j += 13
  
  
      except RemoteDataError:
          print("No information for ticker '%s'" % t)
          j += 13
          continue
  
      except IndexError:
          print("Something went googoo for ticker '%s', trying again..." % t)
          j += 1
          time.sleep(30)
          continue
  
      except Exception, e:
          j+=13
          time.sleep(30)
          continue
  
      except:
          print "Can't find ", ticker
  
  
  input_file.close()
  </code></pre>