python - How to convert numpy dtype=object array to normal ndarray -
i have object type array contains floats (batch_x). want convert array(batch_x normal np ndarray every time try it gives me same error:
valueerror: setting array element sequence.
i tried many different methods none of them worked threw me same error. when try convert reshaping , changing dtype throws error above:
batch_x = batch_x.astype(float).reshape(batch_x.size,1)
batch_x shape: (3427,) batch_x dtype: object
the array try convert looks (batch_x):
[[[ 240. 240. 240.] [ 240. 240. 240.] [ 240. 240. 240.] ..., [ 240. 240. 240.] [ 240. 240. 240.] [ 240. 240. 240.]] [[ 112. 115. 118.] [ 112. 115. 118.] [ 112. 115. 118.] ..., [ 116. 119. 124.] [ 116. 119. 124.] [ 116. 119. 124.]] [[ 33. 37. 43.] [ 33. 37. 43.] [ 33. 37. 43.] ..., [ 40. 44. 52.] [ 40. 44. 52.] [ 40. 44. 52.]] ..., [[ 33. 37. 43.] [ 33. 37. 43.] [ 33. 37. 43.] ..., [ 40. 44. 52.] [ 40. 44. 52.] [ 40. 44. 52.]] [[ 33. 37. 43.] [ 33. 37. 43.] [ 33. 37. 43.] ..., [ 40. 44. 52.] [ 40. 44. 52.] [ 40. 44. 52.]] [[ 33. 37. 43.] [ 33. 37. 43.] [ 33. 37. 43.] ..., [ 40. 44. 52.] [ 40. 44. 52.] [ 40. 44. 52.]]] ###### [[[ 240. 240. 240.] [ 240. 240. 240.] [ 240. 240. 240.] ..., [ 240. 240. 240.] [ 240. 240. 240.] [ 240. 240. 240.]] [[ 112. 115. 118.] [ 112. 115. 118.] [ 112. 115. 118.] ..., [ 116. 119. 124.] [ 116. 119. 124.] [ 116. 119. 124.]] [[ 33. 37. 43.] [ 33. 37. 43.] [ 33. 37. 43.] ..., [ 40. 44. 52.] [ 40. 44. 52.] [ 40. 44. 52.]] ..., [[ 33. 37. 43.] [ 33. 37. 43.] [ 33. 37. 43.] ..., [ 40. 44. 52.] [ 40. 44. 52.] [ 40. 44. 52.]] [[ 33. 37. 43.] [ 33. 37. 43.] [ 33. 37. 43.] ..., [ 40. 44. 52.] [ 40. 44. 52.] [ 40. 44. 52.]] [[ 33. 37. 43.] [ 33. 37. 43.] [ 33. 37. 43.] ..., [ 40. 44. 52.] [ 40. 44. 52.] [ 40. 44. 52.]]]
Comments
Post a Comment