diff --git a/yoshi-seals1.3.3/Seals/write/write.py b/yoshi-seals1.3.3/Seals/write/write.py index b9bd1e9..a2b9461 100644 --- a/yoshi-seals1.3.3/Seals/write/write.py +++ b/yoshi-seals1.3.3/Seals/write/write.py @@ -18,16 +18,34 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. import csv +import numpy as np +import pandas as pd -def numpy(array, path): +class numpy: - with open(path, mode='w') as sistema_linear: + def __init__(self): + pass + def csv(self, array, path): - solution_writer = csv.writer(sistema_linear, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) - solution_writer.writerows(array) - - return array + with open(path, mode='w') as sistema_linear: -def pandas(df, path): - - df.to_csv(path) \ No newline at end of file + solution_writer = csv.writer(sistema_linear, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) + solution_writer.writerows(array) + + def txt(self, array, path): + + np.savetxt(path, array, fmt='%8f', delimiter=' ', \ + newline='\n', header='', footer='', comments='# ', encoding=None) + +class pandas: + + def __init__(self): + pass + def csv(self, df, path): + + df.to_csv(path) + + def txt(self, df, path): + + np.savetxt(path, df.values, fmt='%8f', delimiter=' ', \ + newline='\n', header='', footer='', comments='# ', encoding=None) \ No newline at end of file