title: Decrypting a Fernet CSV, Encoding Issue? Pandas
body: <p>I'm not able to decrypt a csv file. I run the normal process to encrypt, then export to csv. Then I reload into and try to decrypt. </p>
  
  <p>If I block out the csv import line, the script will properly decrypt as expected. </p>
  
  <p>The error I receive says:</p>
  
  <pre><code>InvalidToken: occurred at index Name
  </code></pre>
  
  <p>I tried various iterations of encoding/decoding to no avail.</p>
  
  <pre><code># import data
  data = {'name': ["Joe", "Joe", "Joe","Jane","Jane"],
          'job': ["Analyst","Manager","Director","Analyst","Manager"],
          '#': [1,2,3,4,5],
          'yrs_serv': [1.1, 1.2, 1.3, 1.4, 1.5]}
  df = pd.DataFrame(data, columns=['name', 'job', '#', 'yrs_serv'])
  
  # generate key
  encrypt_key = Fernet.generate_key()
  
  f = Fernet(encrypt_key)
  df = df_e.apply(lambda x: x.astype(str)) # preprocess
  token = df.applymap(lambda x: f.encrypt(x.encode('utf-8')))
  
  # the file goes out to a vendor, and they join some data and send back
  # (I'll delete the new data concatenate it back into the df once the data is decrypted)
  token.to_csv('encrypted_file.csv', index=False)
  
  token = pd.read_csv('encrypted_file.csv') 
  
  token = token.applymap(lambda x: x.encode('utf-8')) # seems the file import wasn't in utf-8
  
  df_decrp = token.applymap(lambda x: f.decrypt(x))
  </code></pre>