Converting from Pandas dataframe to TensorFlow tensor object

后端 未结 6 533
灰色年华
灰色年华 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:38

    here is one solution i found that works on google colab , probably should work in a local machine too

    import pandas as pd
    import tensorflow as tf
    #Read the file to a pandas object
    data=pd.read_csv('filedir')
    #convert the pandas object to a tensor
    data=tf.convert_to_tensor(data)
    type(data)
    

    This must print something like

    tensorflow.python.framework.ops.Tensor
    

    Hope this helps :)

    `

提交回复
热议问题