0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Google Colaboratory でファイルを読み込み

Posted at

Google Colaboratory で CSVファイル読み込み

google colaboratory に読み込んだNotebookでcsvファイルを読み込むには
google driveをマウントした後に、絶対パスを指定すれば読み込むことができる。

ということで、pandasで読み込ませたところ、
エラーになってしまった。

image.png

!ls /content/drive/My\ Drive/csv_data

image.png

見慣れない拡張子がついている。
どうもCSVファイルはアップすると別のファイル形式に変換されるようで、
Driveの設定で変換されないようにする必要があった。

対処方法

Driveに行き、歯車マークをクリック
image.png

設定をクリック
image.png

「アップロードしたファイルを変換する」のチェックをOFFに
image.png

再度CSVファイルをアップロードしてから読み込みます。
image.png

これで、読み込むことができました。

import pandas as pd

df_links = pd.read_csv("/content/drive/My Drive/csv_data/test.csv")
df_links.head()

test.csvの中身が表示されました。
image.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?