I have been trying to output a file from a pandas dataframe that looks like this and I have been trying to write it to a file using a different format
codi Acumulado Ahorro Prestamo Fondo 1 Prestamo Empresa 1
0 0151 1425.76 28320 0.00
1 2361 1158.49 4100 1200.00
2 2663 737.10 2903 429.00
3 2792 897.75 1950 627.00
4 0737 1266.54 7859 0.00
5 5073 779.00 557 754.00
6 2819 1274.70 958 0.00
7 1558 738.51 10242 676.00
8 4105 695.49 2382 0.00
9 4146 1170.08 8623 0.00
10 0528 1337.17 1042 0.00
I tried something like:
df.to_csv(output_file, sep = '|')
but the output its just like a csv but instead of "," I get "|"
I'm trying to achieve this output:
0E0151
A1425.76|2019|Acumulado Ahorro
A0.00|2019|Prestamo Empresa 1
A28320.00|2019|Prestamo Fondo 1
Where 0E has to be concatenated to the number found in column codi, then concatenate the letter "A" to the number found in the column Acumulado ahorro then the char "|" and the name of the column and so on
How can I create this format so it can be written to an actual file?