title: ignore missing files in loop - data did not show up
body: <p>I have thousands of files as you can see the year range below. Some of the dates of the files are missing so I want to skip over them. But when I tried the method below, and calling <code>data_in</code>, the variable doesn't exist.  Any help would be truly appreciated. I am new to python. Thank you.</p>
  
  <pre><code>path = r'file path here' 
  DataYears = ['2012','2013','2014', '2015','2016','2017','2018','2019', '2020']
  Years = np.float64(DataYears)
  NumOfYr = Years.size
  DataMonths = ['01','02','03','04','05','06','07','08','09','10','11','12']
  daysofmonth=[31,28,31,30,31,30,31,31,30,31,30,31]
  for yy in range(NumOfYr):
      for mm in range (12):
          try:
              data_in = pd.read_csv(path+DataYears[yy]+DataMonths[mm]+'/*.dat', skiprows=4, header=None, engine='python')
              print('Reached data_in') # EDIT
              a=data_in[0] #EDIT
          except IOError:
              pass
              #print("File not accessible")
  
  </code></pre>
  
  <p>EDIT: Error added</p>
  
  <pre><code>Traceback (most recent call last):
  
    File "Directory/Documents/test.py", line 23, in &lt;module&gt;
      data_in = pd.read_csv(path+'.'+DataYears[yy]+DataMonths[mm]+'/*.cod', skiprows=4, header=None, engine='python')
  
    File "/opt/anaconda3/lib/python3.7/site-packages/pandas/io/parsers.py", line 676, in parser_f
      return _read(filepath_or_buffer, kwds)
  
    File "/opt/anaconda3/lib/python3.7/site-packages/pandas/io/parsers.py", line 448, in _read
      parser = TextFileReader(fp_or_buf, **kwds)
  
    File "/opt/anaconda3/lib/python3.7/site-packages/pandas/io/parsers.py", line 880, in __init__
      self._make_engine(self.engine)
  
    File "/opt/anaconda3/lib/python3.7/site-packages/pandas/io/parsers.py", line 1126, in _make_engine
      self._engine = klass(self.f, **self.options)
  
    File "/opt/anaconda3/lib/python3.7/site-packages/pandas/io/parsers.py", line 2269, in __init__
      memory_map=self.memory_map,
  
    File "/opt/anaconda3/lib/python3.7/site-packages/pandas/io/common.py", line 431, in get_handle
      f = open(path_or_buf, mode, errors="replace", newline="")
  
  FileNotFoundError: [Errno 2] No such file or directory: 'Directory/Documents/201201/*.dat'
  </code></pre>