962d656e0063a5ef9c0d6463e168d5ef1914ff56,cde/utils/io.py,,append_result_to_csv,#Any#Any#Any#,38

Before Change


  if file_handle.closed:
    return False
  if index == 0:
    result.to_csv(file_handle, sep="", header=True)
  else:
    result.to_csv(file_handle, sep="", header=False, mode="a")
  return True

After Change


  if file_handle.closed:
    return False
  try:
    if os.stat(file_handle.name).st_size == 0: // checks if csv file is empty
      result.to_csv(file_handle.name, sep="", header=True, mode="a", index=True)
      print(index)
    else:
      result.to_csv(file_handle.name, sep="", header=False, mode="a", index=True)
      print(index + 1)
  except Exception as e:
    print("appending to csv not successful")
    print(str(e))
  return True
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: freelunchtheorem/Conditional_Density_Estimation
Commit Name: 962d656e0063a5ef9c0d6463e168d5ef1914ff56
Time: 2018-03-26
Author: f4bio.ferreira@gmail.com
File Name: cde/utils/io.py
Class Name:
Method Name: append_result_to_csv


Project Name: dPys/PyNets
Commit Name: d39d8a845c486869b66ce755a6b634d8ed83c2af
Time: 2019-11-21
Author: dpisner@utexas.edu
File Name: pynets/fmri/clustools.py
Class Name: NilParcellate
Method Name: parcellate


Project Name: okfn-brasil/serenata-de-amor
Commit Name: d5b67dee6fe4630c79424deb87f587f616eba02d
Time: 2016-11-26
Author: filipelinhares@outlook.com
File Name: src/fetch_yelp_info.py
Class Name:
Method Name:


Project Name: ANSSI-FR/SecuML
Commit Name: 42d0ac6260a5dd15bf86e49aa1b30ca8fcadc6c2
Time: 2019-05-17
Author: anael.beaugnon@ssi.gouv.fr
File Name: secuml/core/classif/monitoring/interp/coeff.py
Class Name: Coefficients
Method Name: display