I want to save a pandas dataframe as a csv file, the problem is that to_csv is converting the np.array into a string.
I want to save the array as an array, I could not find anything in the documentation that was useful.
sudoku_solution = [a for a in assignment if a > 0]
label = np.reshape(np.array(sudoku_solution*n_splits),
(n_splits, len(sudoku_solution)))
df = pd.DataFrame(zip(label))
path = './data/SplitsLabel.csv'
try:
df.to_csv(path_or_buf = path,
mode = 'a',
header = False)
solution_sudoku = [123, 345, 894, 324, 321, 321] (list of integers)
n_splits = 3 (integer)
The final results should be something like:
0,[123 345 894 324 321 321]
1,[123 345 894 324 321 321]
3,[123 345 894 324 321 321]
But the result now is:
0,"[123 345 894 324 321 321]"
1,"[123 345 894 324 321 321]"
3,"[123 345 894 324 321 321]"
How do I get rid of those quotes?