m using tensorflow datasets api
and i have a data with a string column that can represents a binary option
(something like ("yes" or "no")
i'm wondering if i convert it into 1 and 0 (integer value) respectively, and leave the other columns unchanged
my skeleton functions is:
def mapper(features,target): #features["str_col"] TODO "MAP this when yes to 1 when no to 0" #return features with x transformed # TODO
can u assist?
You can convert a bool to int:
y = tf.equal(features["str_col"], 'YES') y = tf.cast(y, tf.int32)
1.4m articles
1.4m replys
5 comments
56.9k users