teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

書いている途中で投稿してしまいました。

2020/05/10 04:02

投稿

super.easy.to
super.easy.to

スコア10

title CHANGED
File without changes
body CHANGED
@@ -1,1 +1,37 @@
1
- 機械学習においてgooglelsheetのデータを読み込みたかったのですが、色々なエラーが出てうまくいきません。以下のコードにおいてはじめはengine="python"の部分はなく、その時にはInitializing from file failedとのエラーが出ました。
1
+ 機械学習においてgooglelsheetのデータを読み込みたかったのですが、色々なエラーが出てうまくいきません。以下のコードにおいてはじめはengine="python"の部分はなく、その時にはInitializing from file failedとのエラーが出ました。
2
+
3
+ 実際のコード
4
+ ```python
5
+ from google.colab import drive
6
+ drive.mount('/content/drive')
7
+
8
+ import pandas as pd
9
+ import numpy as np
10
+ import os
11
+
12
+ # エクセルを読み込む
13
+ df_train = pd.read_csv("/content/drive/My Drive/titdata.gsheet" engine="python)
14
+ ```
15
+
16
+ エラー
17
+ ```
18
+ OSError Traceback (most recent call last)
19
+ <ipython-input-15-cbfd4dcd1655> in <module>()
20
+ 7
21
+ 8 # エクセルを読み込む
22
+ ----> 9 df_train = pd.read_csv("/content/drive/My Drive/titdata.gsheet")
23
+
24
+ 4 frames
25
+ /usr/local/lib/python3.6/dist-packages/pandas/io/parsers.py in __init__(self, src, **kwds)
26
+ 1889 kwds["usecols"] = self.usecols
27
+ 1890
28
+ -> 1891 self._reader = parsers.TextReader(src, **kwds)
29
+ 1892 self.unnamed_cols = self._reader.unnamed_cols
30
+ 1893
31
+
32
+ pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader.__cinit__()
33
+
34
+ pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._setup_parser_source()
35
+
36
+ OSError: Initializing from file failed
37
+ ```