[英]how to load a local csv file in tensorflow using Dataset API in colab
I'm trying to upload a csv file from colab to tensorflow using我正在尝试使用将 csv 文件从 colab 上传到 tensorflow
tensorflow.data.Dataset.from_tensor_slices(io.StringIO(uploaded[ 'data.csv'].decode('utf-8')))
and i'm getting this error我收到这个错误
ValueError: Attempt to convert a value (<_io.StringIO object at 0x7f4bb80e8e58>) with an unsupported type (<class '_io.StringIO'>) to a Tensor.
how to solve it?如何解决?
You can upload files in the following way:您可以通过以下方式上传文件:
from google.colab import files
import pandas as pd
import io
uploader = files.upload()
train_data = pd.read_csv(io.StringIO(uploader['data.csv'].decode('utf-8')))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.