I have a data I want to split and convert it to float32 but it is showing the real number as a string
data = open('Path dataset')
for line in data:
train = np.array([np.float32(x) for x in line.split(",")[:]])
And the error that showing me is:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-83-53e8671c416d> in <module>
1 for line in data_coba:
----> 2 train = np.array([np.float32(x) for x in line.split(",")[:]])
3 #print(train_test_coba)
<ipython-input-83-53e8671c416d> in <listcomp>(.0)
1 for line in data_coba:
----> 2 train = np.array([np.float32(x) for x in line.split(",")[:]])
3 #print(train_test_coba)
ValueError: could not convert string to float: '50.89482266'
What is wrong with this?
to convert to floatutf-8-sig, ie.open('Path dataset', encoding='utf-8-sig')