using a list as a value in pandas.DataFeame and tensorFlow
Solution 1:
I think it is not the usual practice to shrink your features into one column.
Quick-fix is you may put the following line
train_features = np.array(train_features['close_price'].to_list())
before
normalizer = tf.keras.layers.Normalization(axis=-1)
to get rid of the error, but now because your train_features has changed from a DataFrame
into a np.array
, your subsequent code may suffer, so you need to take care of that too.
If I were you, however, I would have constructed the DataFrame
this way
df = pd.DataFrame(data)
df['label'] = lables
Please consider.