如何在 Google Colab 上使用示例数据文件?
How to use the sample data files on Google Colab?
Google Colab 附带了一些示例数据文件。我正在使用我想使用的文件的文件路径并尝试使用 pandas.
访问它
pandas.read_csv('content/sample_data/mnist_test.csv')
一直给我这个错误:
FileNotFoundError: File b'content/sample_data/mnist_test.csv' does not exist
我错过了什么?
Colab 给出的路径为 content/sample_data/mnist_test.csv
不使用整个路径,而是删除 content/
并仅使用 sample_data/mnist_test.csv
作为路径。
这个有效:
pandas.read_csv('sample_data/mnist_test.csv')
您在 google-colab 中的当前文件夹是 /content
。您可以使用
pandas.read_csv('sample_data/mnist_test.csv')
或
pandas.read_csv('/content/sample_data/mnist_test.csv')
Google Colab 附带了一些示例数据文件。我正在使用我想使用的文件的文件路径并尝试使用 pandas.
访问它pandas.read_csv('content/sample_data/mnist_test.csv')
一直给我这个错误:
FileNotFoundError: File b'content/sample_data/mnist_test.csv' does not exist
我错过了什么?
Colab 给出的路径为 content/sample_data/mnist_test.csv
不使用整个路径,而是删除 content/
并仅使用 sample_data/mnist_test.csv
作为路径。
这个有效:
pandas.read_csv('sample_data/mnist_test.csv')
您在 google-colab 中的当前文件夹是 /content
。您可以使用
pandas.read_csv('sample_data/mnist_test.csv')
或
pandas.read_csv('/content/sample_data/mnist_test.csv')