-4
は私が助けてください打つ:値エラー上記の最後の行で PYTHON:シンプルフロート変換はなぜ機能していませんか?この単純な変換がうまくいかないのはなぜ
print(getx)
Date
2017-12-08 -4.484884
Name: CCI, dtype: float64
chkccisplt=getx
type(getx)
chksplt=str(getx)
type(chksplt)
print(chksplt)
Date
2017-12-08 -4.484884
Name: CCI, dtype: float64
chkdt,chkcci=chksplt.split(" ")
print(chkdt)
Date
2017-12-08
print(chkcci)
-4.484884
Name: CCI, dtype: float64
chkcci=chkcci.strip()
chkcciflt=float(chkcci)
**ValueError: could not convert string to float: '-4.484884\nName: CCI, dtype:
float64'**
をバックスローされます。 あなたのすべての回答を事前におねがいします。
chkcci=chkcci.split('\n')[0].strip()
へ
エラーメッセージを再度読みます。文字列 '' -4.484884 \ nName:CCI、dtype: float64''は正しいfloat番号ではありません。 – furas