title: How to extract multiples pdfs from huge csv file
body: <p>Im beginning in Python and I have to extract multiples pdf files form a huge csv file. I tried chunk method to read CSV file data. With the code below, I could extract only one pdf file.
  I have some doubts :</p>
  <ol>
  <li>How I can Know the number of pdf files in this csv ?</li>
  <li>How can I extract all of them ?</li>
  </ol>
  <p>I ask for some help...</p>
  <p>Thanks !!</p>
  <p>I tried the code :</p>
  <pre><code>    import pandas as pd
      import inspect
      import pprint
      import pandas as module
      functions = inspect.getmembers(module, inspect.isfunction)
      pprint.pprint(functions)
      import numpy as np
      from matplotlib import pyplot as plt
      from datetime import datetime
      import seaborn as sns
  
      import csv
      from itertools import dropwhile, takewhile
  
      def getstuff(filename):
          with open(filename, &quot;r&quot;) as csvfile:
      datareader = csv.reader(csvfile)
      yield next(datareader)  # yield the header row
      # first row, plus any subsequent rows that match, then stop
      # reading altogether
      # Python 2: use `for row in takewhile(...): yield row` instead
      # instead of `yield from takewhile(...)`.
      #yield from takewhile(
          #lambda r: r[3] == criterion,
          #dropwhile(lambda r: r[3] != criterion, datareader))
      #return
  
      def getdata(filename):
          #for criterion in criteria:
              for row in getstuff(filename):
                  yield row
  
      generator=getstuff('C:\\Users\saitosp\Desktop\InCor\CAT1I_ecg_x.csv')
      print(next(generator))
      print(next(generator))
      print(next(generator))
      print(next(generator))
  
      chunksize=500
      ecg=pd.read_csv('C:\\Users\saitosp\Desktop\InCor\CAT1I_ecg_x.csv', chunksize=chunksize)
  
      list(ecg.get_chunk(1000))
      ecg.get_chunk(1000)
      df=ecg.get_chunk(1000)
  
      empty_cols = [col for col in df.columns if df[col].isnull().all()]
      # Drop these columns from the dataframe
      df.drop(empty_cols,
      axis=1,
      inplace=True)
  
      for index, row in df.iterrows():
          print(row['OBJECTID'], row['OBJECTTYPE'])
  
      def print_full(x):
          pd.set_option('display.max_rows', len(x))
          pd.set_option('display.max_columns', None)
          pd.set_option('display.width', 2000)
          pd.set_option('display.float_format', '{:20,.2f}'.format)
          pd.set_option('display.max_colwidth', -1)
          print(x)
          pd.reset_option('display.max_rows')
          pd.reset_option('display.max_columns')
          pd.reset_option('display.width')
          pd.reset_option('display.float_format')
          pd.reset_option('display.max_colwidth')
  
      print_full(df.iloc[0][&quot;OBJECTDATA&quot;])
      b64=df.iloc[0][&quot;OBJECTDATA&quot;]
      from base64 import b64decode
      bytes = b64decode(b64, validate=True)
      # Write the PDF contents to a local file
      f = open('file.pdf', 'wb')
      f.write(bytes)
      f.close()
  </code></pre>