pandas csv-Datei Spltentyp
Verfasst: Dienstag 18. April 2023, 14:36
Hallo,
in einen CSV-Datei, die ich mit Pandas auslese sind u.a. folgende Spalten (Objelte)
**************
Einheit Verkaufspreis Gesamt Einkaufspreis Gesamt.1 Erfassungsdatum \
0 Stck 8558,60 0,00 5970,00 0,00 16.12.2021
1 Stck 96,30 0,00 0,00 0,00 16.12.2022
2 Stck 1124,55 0,00 803,25 0,00 01.09.2022
3 Stck 150,00 0,00 86,91 0,00 17.08.2021
4 Stck 62,00 0,00 31,89 0,00 24.04.2021
.. ... ... ... ... ... ...
***************
print(df.dtypes)
bringt mit folgende Ergebnis:
Artikelnummer object
Typ object
Artikelbeschreibung object
Einheit object
Verkaufspreis object
Gesamt object
Einkaufspreis object
Gesamt.1 object
Erfassungsdatum object
Preisgruppe Standard object
Preisgruppe keine object
Preisgruppe object
Teile-Nr. float64
dtype: object
Mein Versuch das Objekt 'Einkaufpreis' in float zu convertieren scheitert mit:
could not convert string to float: '5970,00'
Was mache ich hier falsch?
Gruß
Armin
in einen CSV-Datei, die ich mit Pandas auslese sind u.a. folgende Spalten (Objelte)
**************
Einheit Verkaufspreis Gesamt Einkaufspreis Gesamt.1 Erfassungsdatum \
0 Stck 8558,60 0,00 5970,00 0,00 16.12.2021
1 Stck 96,30 0,00 0,00 0,00 16.12.2022
2 Stck 1124,55 0,00 803,25 0,00 01.09.2022
3 Stck 150,00 0,00 86,91 0,00 17.08.2021
4 Stck 62,00 0,00 31,89 0,00 24.04.2021
.. ... ... ... ... ... ...
***************
print(df.dtypes)
bringt mit folgende Ergebnis:
Artikelnummer object
Typ object
Artikelbeschreibung object
Einheit object
Verkaufspreis object
Gesamt object
Einkaufspreis object
Gesamt.1 object
Erfassungsdatum object
Preisgruppe Standard object
Preisgruppe keine object
Preisgruppe object
Teile-Nr. float64
dtype: object
Mein Versuch das Objekt 'Einkaufpreis' in float zu convertieren scheitert mit:
could not convert string to float: '5970,00'
Was mache ich hier falsch?
Gruß
Armin