title: How to get the line number of a warning that made by pandas
body: <p><strong>Edited:</strong></p>
  
  <p>I have some codes written in <code>Python</code> and used pandas to make and manipulate some DataFrames. In a few of them, I get some warnings. for example settingwithcopywarning or performancewarning. I want to catch the <strong>lineno</strong> that warning has happened and for that, I wrote the following code. I catch everything except lineno.</p>
  
  <pre><code>scripts = ['myfile.py', 'myotherfile.py']
  with warnings.catch_warnings(record=True) as w:
      # Cause all warnings to always be triggered.
      warnings.simplefilter("default")
      for s in scripts:
          with open(s) as f:
              try:
                  exec(f.read())
              except Exception as e:
                  print('An Error happend during the execution', e)
                  raise
              finally:    
                  f.close()    
  
      print(color.orange('There are {} error/s happend in {}.'.format(len(w), s)))
      for i in range(0, len(w)):
          print(color.green('LineNo: '), w[i].lineno)
          print(color.green('Line: '), w[i].line)
          print(color.green('warning category: '), w[i].category.__name__)
          print(color.green('Warning: '), w[i].message) 
          print(color.green('filename: '), w[i].file) 
          print(color.cyan('-' * 40))
  </code></pre>
  
  <p>for <code>w[i].lineno</code> I expect the <strong>line number</strong>.</p>
  
  <p>The number that I am getting does not belong to the original file. it belongs to python core modules. I get something like 5312. 
  how can I trace back the lineno to my own script?</p>