将数据上传到 google colab 以字典的形式出现,这与上传到笔记本不同。为什么是这样?
Uploading data to google colab comes as dictionary, unlike uploading to notebook. Why is this?
如何在 colab 中将字典更改为数据框?
我添加了两张图片。一个来自colab,另一个来自notebook。
https://i.stack.imgur.com/o9yMf.png
https://i.stack.imgur.com/DcY8T.png
谢谢!
使用您的笔记本,您已使用 Pandas 库读取数据
data = pd.read_csv('data.csv')
这就是您将其作为数据框上传的原因。虽然 files.upload()
函数将您的文件上传为字典,您需要将其作为数据框读取。但是,您只需要在使用
上传数据后再次读取数据
data = pd.read_csv('DailyDelhiClimateTest.csv.csv')
祝你好运:)
如何在 colab 中将字典更改为数据框?
我添加了两张图片。一个来自colab,另一个来自notebook。
https://i.stack.imgur.com/o9yMf.png
https://i.stack.imgur.com/DcY8T.png
谢谢!
使用您的笔记本,您已使用 Pandas 库读取数据
data = pd.read_csv('data.csv')
这就是您将其作为数据框上传的原因。虽然 files.upload()
函数将您的文件上传为字典,您需要将其作为数据框读取。但是,您只需要在使用
data = pd.read_csv('DailyDelhiClimateTest.csv.csv')
祝你好运:)