für das folgende Array, mag ich Kommas mit Punkten ersetzen:ersetzen Komma mit Punkt Pandas
array(['0,140711', '0,140711', '0,0999', '0,0999', '0,001', '0,001',
'0,140711', '0,140711', '0,140711', '0,140711', '0,140711',
'0,140711', 0L, 0L, 0L, 0L, '0,140711', '0,140711', '0,140711',
'0,140711', '0,140711', '0,1125688', '0,140711', '0,1125688',
'0,140711', '0,1125688', '0,140711', '0,1125688', '0,140711',
'0,140711', '0,140711', '0,140711', '0,140711', '0,140711',
'0,140711', '0,140711', '0,140711', '0,140711', '0,140711',
'0,140711', '0,140711', '0,140711', '0,140711', '0,140711',
'0,140711', '0,140711', '0,140711', '0,140711'], dtype=object)
Ich habe verschiedene Wege versucht, aber ich kann leider nicht herausfinden, wie dies zu tun. Außerdem habe ich als Datenrahmen kann aber die Funktion nicht für:
df
1-8 1-7
H0 0,140711 0,140711
H1 0,0999 0,0999
H2 0,001 0,001
H3 0,140711 0,140711
H4 0,140711 0,140711
H5 0,140711 0,140711
H6 0 0
H7 0 0
H8 0,140711 0,140711
H9 0,140711 0,140711
H10 0,140711 0,1125688
H11 0,140711 0,1125688
H12 0,140711 0,1125688
H13 0,140711 0,1125688
H14 0,140711 0,140711
H15 0,140711 0,140711
H16 0,140711 0,140711
H17 0,140711 0,140711
H18 0,140711 0,140711
H19 0,140711 0,140711
H20 0,140711 0,140711
H21 0,140711 0,140711
H22 0,140711 0,140711
H23 0,140711 0,140711
df.applymap(lambda x: str(x.replace(',','.')))
Jeden Vorschlag? Dank
'df.applymap (lambda x: ' 'str (x.replace (',',)))' funktioniert, ersetzt auf 'Punkt Komma pd .__ Version__ == ' 0.18.1'' – Zero
Haben Sie das Ergebnis zurückgewiesen? 'df = df.applymap (Lambda x: str (x.replace (',', '.')))' – EdChum
Auch wäre es für jede Spalte schneller: 'df = df.apply (Lambda x : x.str.replace (',', '.')) ' – EdChum