main_16.py 396 B

12345678910
  1. def base64_method(data_path, columns):
  2. data = pd.read_csv(data_path)
  3. data.dropna()
  4. data.reset_index(drop=True, inplace=True)
  5. existing_columns = list(data)
  6. for column in columns:
  7. if column in existing_columns:
  8. data[column] = data[column].apply(str)
  9. data[column] = data[column].apply(lambda x: base64.b64encode(bytes(x, 'utf-8')))
  10. return data