Skip to content

Commit

Permalink
Update preprocessing_layers.ipynb
Browse files Browse the repository at this point in the history
bug fix
ValueError: Multi-dimensional indexing (e.g. `obj[:, None]`) is no longer supported. Convert to a numpy array before indexing instead.
  • Loading branch information
Mikhaylov-yv authored Nov 12, 2023
1 parent 60abeb0 commit 5f3d273
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 5f3d273

Please sign in to comment.