Converting from Pandas dataframe to TensorFlow tensor object

后端 未结 6 534
灰色年华
灰色年华 2020-12-31 02:48

I\'m still new to Python, Machine Learning and TensorFlow, but doing my best to jump right in head-first. I could use some help though.

My data is currently in a Pan

6条回答
  •  情深已故
    2020-12-31 03:18

    You can convert a the dataframe column to a tensor object like so:

    tf.constant((df['column_name']))
    

    This should return you a tensor variable which looks something like this:

    
    

    Also, you can ad any number of dataframe columns as you want, like so:

    tf.constant(([cdf['column1'], cdf['column2']]))
    

    Hope this helps.

提交回复
热议问题