Вы можете print
значения в l oop с f-string
с для 3 цифр после десятичного числа с join
:
for x in df.values:
print (','.join(f'{y:.4f}' for y in x))
0.4444,0.0000,0.0000,0.0000,0.1111,0.0000,0.2222,0.0000,0.0000,0.0000
0.4444,0.3333,0.3333,0.4444,0.6667,1.0000,0.2222,0.1111,0.0000,0.0000
0.2222,0.0000,0.0000,0.0000,0.1111,0.1111,0.2222,0.0000,0.0000,0.0000
Если не хотите новой строки, получите одну строку данных:
for x in df.values:
print (','.join(f'{y:.4f}' for y in x), end='')
0.4444,0.0000,0.0000,0.0000,0.1111,0.0000,0.2222,0.0000,0.0000,0.00000.4444,0.3333,0.3333,0.4444,0.6667,1.0000,0.2222,0.1111,0.0000,0.00000.2222,0.0000,0.0000,0.0000,0.1111,0.1111,0.2222,0.0000,0.0000,0.0000