How we can view our downloaded Tensorflow_datasets?

I want to view my downloaded data in tensor flow

Ratings data.

ratings = tfds.load(‘movielens/100k-ratings’, split=“train”)

Features of all the available movies.

movies = tfds.load(‘movielens/100k-movies’, split=“train”)

Select the basic features.

ratings = ratings.map(lambda x: {
“movie_title”: x[“movie_title”],
“user_id”: x[“user_id”]
})
movies = movies.map(lambda x: x[“movie_title”])

Hi @Priyank_Dubey, You can view the data present in the ratings dataset using

for data in ratings.take(5):
  print(data)

The output looks like

{'bucketized_user_age': <tf.Tensor: shape=(), dtype=float32, numpy=45.0>, 'movie_genres': <tf.Tensor: shape=(1,), dtype=int64, numpy=array([7])>, 'movie_id': <tf.Tensor: shape=(), dtype=string, numpy=b'357'>, 'movie_title': <tf.Tensor: shape=(), dtype=string, numpy=b"One Flew Over the Cuckoo's Nest (1975)">, 'raw_user_age': <tf.Tensor: shape=(), dtype=float32, numpy=46.0>, 'timestamp': <tf.Tensor: shape=(), dtype=int64, numpy=879024327>, 'user_gender': <tf.Tensor: shape=(), dtype=bool, numpy=True>, 'user_id': <tf.Tensor: shape=(), dtype=string, numpy=b'138'>, 'user_occupation_label': <tf.Tensor: shape=(), dtype=int64, numpy=4>, 'user_occupation_text': <tf.Tensor: shape=(), dtype=string, numpy=b'doctor'>, 'user_rating': <tf.Tensor: shape=(), dtype=float32, numpy=4.0>, 'user_zip_code': <tf.Tensor: shape=(), dtype=string, numpy=b'53211'>}
{'bucketized_user_age': <tf.Tensor: shape=(), dtype=float32, numpy=25.0>, 'movie_genres': <tf.Tensor: shape=(2,), dtype=int64, numpy=array([ 4, 14])>, 'movie_id': <tf.Tensor: shape=(), dtype=string, numpy=b'709'>, 'movie_title': <tf.Tensor: shape=(), dtype=string, numpy=b'Strictly Ballroom (1992)'>, 'raw_user_age': <tf.Tensor: shape=(), dtype=float32, numpy=32.0>, 'timestamp': <tf.Tensor: shape=(), dtype=int64, numpy=875654590>, 'user_gender': <tf.Tensor: shape=(), dtype=bool, numpy=True>, 'user_id': <tf.Tensor: shape=(), dtype=string, numpy=b'92'>, 'user_occupation_label': <tf.Tensor: shape=(), dtype=int64, numpy=5>, 'user_occupation_text': <tf.Tensor: shape=(), dtype=string, numpy=b'entertainment'>, 'user_rating': <tf.Tensor: shape=(), dtype=float32, numpy=2.0>, 'user_zip_code': <tf.Tensor: shape=(), dtype=string, numpy=b'80525'>}
{'bucketized_user_age': <tf.Tensor: shape=(), dtype=float32, numpy=18.0>, 'movie_genres': <tf.Tensor: shape=(1,), dtype=int64, numpy=array([4])>, 'movie_id': <tf.Tensor: shape=(), dtype=string, numpy=b'412'>, 'movie_title': <tf.Tensor: shape=(), dtype=string, numpy=b'Very Brady Sequel, A (1996)'>, 'raw_user_age': <tf.Tensor: shape=(), dtype=float32, numpy=24.0>, 'timestamp': <tf.Tensor: shape=(), dtype=int64, numpy=882075110>, 'user_gender': <tf.Tensor: shape=(), dtype=bool, numpy=True>, 'user_id': <tf.Tensor: shape=(), dtype=string, numpy=b'301'>, 'user_occupation_label': <tf.Tensor: shape=(), dtype=int64, numpy=17>, 'user_occupation_text': <tf.Tensor: shape=(), dtype=string, numpy=b'student'>, 'user_rating': <tf.Tensor: shape=(), dtype=float32, numpy=4.0>, 'user_zip_code': <tf.Tensor: shape=(), dtype=string, numpy=b'55439'>}
{'bucketized_user_age': <tf.Tensor: shape=(), dtype=float32, numpy=50.0>, 'movie_genres': <tf.Tensor: shape=(2,), dtype=int64, numpy=array([5, 7])>, 'movie_id': <tf.Tensor: shape=(), dtype=string, numpy=b'56'>, 'movie_title': <tf.Tensor: shape=(), dtype=string, numpy=b'Pulp Fiction (1994)'>, 'raw_user_age': <tf.Tensor: shape=(), dtype=float32, numpy=50.0>, 'timestamp': <tf.Tensor: shape=(), dtype=int64, numpy=883326919>, 'user_gender': <tf.Tensor: shape=(), dtype=bool, numpy=True>, 'user_id': <tf.Tensor: shape=(), dtype=string, numpy=b'60'>, 'user_occupation_label': <tf.Tensor: shape=(), dtype=int64, numpy=4>, 'user_occupation_text': <tf.Tensor: shape=(), dtype=string, numpy=b'healthcare'>, 'user_rating': <tf.Tensor: shape=(), dtype=float32, numpy=4.0>, 'user_zip_code': <tf.Tensor: shape=(), dtype=string, numpy=b'06472'>}
{'bucketized_user_age': <tf.Tensor: shape=(), dtype=float32, numpy=50.0>, 'movie_genres': <tf.Tensor: shape=(2,), dtype=int64, numpy=array([10, 16])>, 'movie_id': <tf.Tensor: shape=(), dtype=string, numpy=b'895'>, 'movie_title': <tf.Tensor: shape=(), dtype=string, numpy=b'Scream 2 (1997)'>, 'raw_user_age': <tf.Tensor: shape=(), dtype=float32, numpy=55.0>, 'timestamp': <tf.Tensor: shape=(), dtype=int64, numpy=891409199>, 'user_gender': <tf.Tensor: shape=(), dtype=bool, numpy=True>, 'user_id': <tf.Tensor: shape=(), dtype=string, numpy=b'197'>, 'user_occupation_label': <tf.Tensor: shape=(), dtype=int64, numpy=18>, 'user_occupation_text': <tf.Tensor: shape=(), dtype=string, numpy=b'technician'>, 'user_rating': <tf.Tensor: shape=(), dtype=float32, numpy=3.0>, 'user_zip_code': <tf.Tensor: shape=(), dtype=string, numpy=b'75094'>}

To view the specific column data you have to pass the column name,

for data in ratings.take(5):
  print(data['movie_title'])
#output
tf.Tensor(b"One Flew Over the Cuckoo's Nest (1975)", shape=(), dtype=string)
tf.Tensor(b'Strictly Ballroom (1992)', shape=(), dtype=string)
tf.Tensor(b'Very Brady Sequel, A (1996)', shape=(), dtype=string)
tf.Tensor(b'Pulp Fiction (1994)', shape=(), dtype=string)
tf.Tensor(b'Scream 2 (1997)', shape=(), dtype=string)

To get the exact values you can use .numpy method

for data in ratings.take(5):
  print(data['movie_title'].numpy())
#output
b"One Flew Over the Cuckoo's Nest (1975)"
b'Strictly Ballroom (1992)'
b'Very Brady Sequel, A (1996)'
b'Pulp Fiction (1994)'
b'Scream 2 (1997)'

Thank You.