# Feature\_columns.ipynb : AttributeError: module 'keras.\_tf\_keras.keras.layers' has no attribute 'DenseFeatures'

**URL:** <https://community.deeplearning.ai/t/feature-columns-ipynb-attributeerror-module-keras-tf-keras-keras-layers-has-no-attribute-densefeatures/693636>\
**Category:** Data Pipelines with TensorFlow Data Services\
**Tags:** week-module-3\
**Created:** [September 17, 2024, 9:20am UTC](https://community.deeplearning.ai/t/feature-columns-ipynb-attributeerror-module-keras-tf-keras-keras-layers-has-no-attribute-densefeatures/693636 "2024-09-17T09:20:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thierry\_Pochon](https://avatars.discourse-cdn.com/v4/letter/t/6bbea6/32.png) [@Thierry\_Pochon](https://community.deeplearning.ai/u/Thierry_Pochon)\
**Post date:** [September 17, 2024, 9:20am UTC](https://community.deeplearning.ai/t/feature-columns-ipynb-attributeerror-module-keras-tf-keras-keras-layers-has-no-attribute-densefeatures/693636/1 "2024-09-17T09:20:20Z")

</div>

in notebook feature\_columns.ipynb : [Coursera | Online Courses & Credentials From Top Educators. Join for Free | Coursera](https://www.coursera.org/learn/data-pipelines-tensorflow/supplement/WZHga/link-to-the-notebook)

when I run cell :  
photo\_count = feature\_column.numeric\_column(‘PhotoAmt’)  
demo(photo\_count)

I get the error :  
AttributeError: module ‘keras.\_tf\_keras.keras.layers’ has no attribute ‘DenseFeatures’

I am using imports :  
import numpy as np  
import pandas as pd  
import tensorflow as tf  
from tensorflow import feature\_column  
from tensorflow.keras import layers  
from sklearn.model\_selection import train\_test\_split  
print(tf. **version** )

I am using tensorflow version : 2.17.0

Is it linked to warning at the beginning of the notebook ?  
Warning: The `tf.feature_columns` module described in this tutorial is not recommended for new code. [Keras preprocessing layers](https://www.google.com/url?q=https%3A%2F%2Fwww.tensorflow.org%2Ftutorials%2Fstructured_data%2Fpreprocessing_layers) cover this functionality, for migration instructions see the [Migrating feature columns](https://colab.research.google.com/guide/migrate/migrating_feature_columns.ipynb) guide. The `tf.feature_columns` module was designed for use with TF1 `Estimators`. It does fall under our [compatibility guarantees](https://tensorflow.org/guide/versions), but will receive no fixes other than security vulnerabilities.

So what should I do ? replace tf.feature\_columns by : [Classifier les données structurées à l'aide des couches de prétraitement Keras &nbsp;|&nbsp; TensorFlow Core](https://www.tensorflow.org/tutorials/structured_data/preprocessing_layers?hl=fr#apply_the_keras_preprocessing_layers)

Or should I use tf1.keras.layers.DenseFeatures : [Classifier les données structurées à l'aide des couches de prétraitement Keras &nbsp;|&nbsp; TensorFlow Core](https://www.tensorflow.org/tutorials/structured_data/preprocessing_layers?hl=fr) ?

Thank you for your help

---

<div class="post-metadata">

**Author:** ![Thierry\_Pochon](https://avatars.discourse-cdn.com/v4/letter/t/6bbea6/32.png) [@Thierry\_Pochon](https://community.deeplearning.ai/u/Thierry_Pochon)\
**Post date:** [September 17, 2024, 9:37am UTC](https://community.deeplearning.ai/t/feature-columns-ipynb-attributeerror-module-keras-tf-keras-keras-layers-has-no-attribute-densefeatures/693636/2 "2024-09-17T09:37:26Z")

</div>

I succeeded in running notebook feature\_columns.ipynb not from course ([Google Colab](https://colab.research.google.com/github/tensorflow/docs/blob/master/site/en/tutorials/structured_data/feature_columns.ipynb)) but from : [Classify structured data using Keras preprocessing layers &nbsp;|&nbsp; TensorFlow Core](https://www.tensorflow.org/tutorials/structured_data/preprocessing_layers?hl=en), in codelab : [Google Colab](https://colab.research.google.com/github/tensorflow/docs/blob/master/site/en/tutorials/structured_data/preprocessing_layers.ipynb?hl=en)

---

<div class="post-metadata">

**Author:** ![Cormac\_Garvey](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/cormac_garvey/32/98660_2.png) [@Cormac\_Garvey](https://community.deeplearning.ai/u/Cormac_Garvey)\
**Post date:** [January 8, 2025, 3:00pm UTC](https://community.deeplearning.ai/t/feature-columns-ipynb-attributeerror-module-keras-tf-keras-keras-layers-has-no-attribute-densefeatures/693636/3 "2025-01-08T15:00:49Z")

</div>

I have the same issue. It looks like this feature\_columns.ipynb no longer runs and must be updated. i had many fails:

 ![image](https://global.discourse-cdn.com/dlai/original/3X/d/5/d54fd20202f78c15d98acdea6bef6bd21a23fd9b.png)

none of the feaulte\_columns examples worked. here is one example:

 ![image](https://global.discourse-cdn.com/dlai/original/3X/1/f/1f782761de0f0231fa40c3d3c4decd13d473bfe4.png)

I wonder , can a moderator report this? 🤔
