diff --git a/site/en/tutorials/structured_data/preprocessing_layers.ipynb b/site/en/tutorials/structured_data/preprocessing_layers.ipynb index 928a56eb8bc..b9afe29a710 100644 --- a/site/en/tutorials/structured_data/preprocessing_layers.ipynb +++ b/site/en/tutorials/structured_data/preprocessing_layers.ipynb @@ -297,7 +297,7 @@ "def df_to_dataset(dataframe, shuffle=True, batch_size=32):\n", " df = dataframe.copy()\n", " labels = df.pop('target')\n", - " df = {key: value[:,tf.newaxis] for key, value in dataframe.items()}\n", + " df = {key: value.to_numpy()[:,tf.newaxis] for key, value in dataframe.items()}\n", " ds = tf.data.Dataset.from_tensor_slices((dict(df), labels))\n", " if shuffle:\n", " ds = ds.shuffle(buffer_size=len(dataframe))\n",