我有一个带有三列的pandas DataFrame,其中包含字符串和numpy ndarray(图像)。 就像这样:
combobox
当我执行pd.read_csv时,它将所有内容存储为字符串。如何将字符串转换为numpy ndarray? 我尝试过:
/some/strings/
[[[ 127. 123. 34,..
np.ndarray
np.ndarray
string
...
错误:
im1 = pd.Series(df.iloc[0,0]).to_numpy(dtype ='float32')
could not convert string to float: '[[[[153. 150. 135.]\n [151. 148. 133.]\n [151. 148. 133.]\n ...\n [ 51. 47. 38.]\n [ 38. 34. 25.]\n [ 43. 39. 30.]]\n\n [[153. 150. 135.]\n [151. 148. 133.]\n [152. 149. 134.]\n ....
错误:
i1,i2,s = np.genfromtxt('df.csv', delimiter=',', unpack=True, usecols=[0,1,2])
您有什么建议吗?