質問編集履歴
1
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,83 +14,17 @@
|
|
14
14
|
|
15
15
|
FileNotFoundError Traceback (most recent call last)
|
16
16
|
|
17
|
-
<ipython-input-
|
17
|
+
<ipython-input-4-f65807ec2284> in <module>()
|
18
18
|
|
19
|
-
----> 1
|
19
|
+
----> 1 with open(r'D:\Users\tseikyou\Housing.xlsx') as f:
|
20
|
+
|
21
|
+
2 print(type(f))
|
20
22
|
|
21
23
|
|
22
24
|
|
23
|
-
|
25
|
+
FileNotFoundError: [Errno 2] No such file or directory: 'D:\Users\tseikyou\Housing.xlsx'
|
24
|
-
|
25
|
-
175 else:
|
26
|
-
|
27
|
-
176 kwargs[new_arg_name] = new_arg_value
|
28
|
-
|
29
|
-
--> 177 return func(*args, **kwargs)
|
30
|
-
|
31
|
-
178 return wrapper
|
32
|
-
|
33
|
-
179 return _deprecate_kwarg
|
34
26
|
|
35
27
|
|
36
|
-
|
37
|
-
~\Anaconda3\lib\site-packages\pandas\util\_decorators.py in wrapper(*args, **kwargs)
|
38
|
-
|
39
|
-
175 else:
|
40
|
-
|
41
|
-
176 kwargs[new_arg_name] = new_arg_value
|
42
|
-
|
43
|
-
--> 177 return func(*args, **kwargs)
|
44
|
-
|
45
|
-
178 return wrapper
|
46
|
-
|
47
|
-
179 return _deprecate_kwarg
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
~\Anaconda3\lib\site-packages\pandas\io\excel.py in read_excel(io, sheet_name, header, names, index_col, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, parse_dates, date_parser, thousands, comment, skipfooter, convert_float, **kwds)
|
52
|
-
|
53
|
-
305
|
54
|
-
|
55
|
-
306 if not isinstance(io, ExcelFile):
|
56
|
-
|
57
|
-
--> 307 io = ExcelFile(io, engine=engine)
|
58
|
-
|
59
|
-
308
|
60
|
-
|
61
|
-
309 return io.parse(
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
~\Anaconda3\lib\site-packages\pandas\io\excel.py in __init__(self, io, **kwds)
|
66
|
-
|
67
|
-
392 self.book = xlrd.open_workbook(file_contents=data)
|
68
|
-
|
69
|
-
393 elif isinstance(self._io, compat.string_types):
|
70
|
-
|
71
|
-
--> 394 self.book = xlrd.open_workbook(self._io)
|
72
|
-
|
73
|
-
395 else:
|
74
|
-
|
75
|
-
396 raise ValueError('Must explicitly set engine if not passing in'
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
~\Anaconda3\lib\site-packages\xlrd\__init__.py in open_workbook(filename, logfile, verbosity, use_mmap, file_contents, encoding_override, formatting_info, on_demand, ragged_rows)
|
80
|
-
|
81
|
-
114 peek = file_contents[:peeksz]
|
82
|
-
|
83
|
-
115 else:
|
84
|
-
|
85
|
-
--> 116 with open(filename, "rb") as f:
|
86
|
-
|
87
|
-
117 peek = f.read(peeksz)
|
88
|
-
|
89
|
-
118 if peek == b"PK\x03\x04": # a ZIP file
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
FileNotFoundError: [Errno 2] No such file or directory: 'Housing.xlsx'
|
94
28
|
|
95
29
|
|
96
30
|
|
@@ -140,7 +74,13 @@
|
|
140
74
|
|
141
75
|
|
142
76
|
|
143
|
-
|
77
|
+
os.path.abspath("Housing.xlsx")
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
with open(r'D:\Users\tseikyou\Housing.xlsx') as f:
|
82
|
+
|
83
|
+
print(type(f))
|
144
84
|
|
145
85
|
```
|
146
86
|
|
@@ -150,23 +90,7 @@
|
|
150
90
|
|
151
91
|
|
152
92
|
|
153
|
-
一度同じエラーがでたので
|
154
|
-
|
155
|
-
import os, inspect
|
156
|
-
|
157
|
-
|
93
|
+
os.path.abspath("Housing.xlsx")
|
158
|
-
|
159
|
-
fx = inspect.getframeinfo(inspect.currentframe())[0]
|
160
|
-
|
161
|
-
else:
|
162
|
-
|
163
|
-
fx = Housing.xlsx
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
os_dir = os.path.dirname(os.path.abspath(fx))
|
168
|
-
|
169
|
-
print(os_dir)
|
170
94
|
|
171
95
|
|
172
96
|
|