質問編集履歴
7
誤字を直した
test
CHANGED
File without changes
|
test
CHANGED
@@ -142,4 +142,4 @@
|
|
142
142
|
|
143
143
|
### 補足情報(FW/ツールのバー
|
144
144
|
|
145
|
-
|
145
|
+
WindowでDocker を用いてPythonの環境構築をしています
|
6
何を用いて環境構築したのかを書いた
test
CHANGED
File without changes
|
test
CHANGED
@@ -140,8 +140,6 @@
|
|
140
140
|
|
141
141
|
|
142
142
|
|
143
|
-
### 補足情報(FW/ツールのバー
|
143
|
+
### 補足情報(FW/ツールのバー
|
144
144
|
|
145
|
-
|
146
|
-
|
147
|
-
|
145
|
+
windows hoem で docker を用いてPythonの環境構築をしています
|
5
ご返信いただいたものを実行したものとその結果を載せました
test
CHANGED
File without changes
|
test
CHANGED
@@ -50,7 +50,7 @@
|
|
50
50
|
|
51
51
|
print(os.listdir('C:\Users\81809\Desktop\MyPandas'))
|
52
52
|
|
53
|
-
|
53
|
+
を実行しました
|
54
54
|
|
55
55
|
### 該当のソースコード
|
56
56
|
|
@@ -104,6 +104,30 @@
|
|
104
104
|
|
105
105
|
の部分を実行して出てきたエラーです。
|
106
106
|
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
---------------------------------------------------------------------------
|
112
|
+
|
113
|
+
FileNotFoundError Traceback (most recent call last)
|
114
|
+
|
115
|
+
<ipython-input-14-e94924d920fe> in <module>
|
116
|
+
|
117
|
+
----> 1 print(os.listdir('C:\Users\81809\Desktop'))
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
print(os.listdir('C:\Users\8***9\Desktop'))を実行した結果が下記です
|
128
|
+
|
129
|
+
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\81809\Desktop'
|
130
|
+
|
107
131
|
```
|
108
132
|
|
109
133
|
|
4
jbpb0様から頂いたアドバイスのもとに実行したもののコードと結果を載せました
test
CHANGED
File without changes
|
test
CHANGED
@@ -46,7 +46,11 @@
|
|
46
46
|
|
47
47
|
```
|
48
48
|
|
49
|
+
追記)import os
|
49
50
|
|
51
|
+
print(os.listdir('C:\Users\81809\Desktop\MyPandas'))
|
52
|
+
|
53
|
+
のを実行しました
|
50
54
|
|
51
55
|
### 該当のソースコード
|
52
56
|
|
@@ -78,15 +82,27 @@
|
|
78
82
|
|
79
83
|
|
80
84
|
|
85
|
+
---------------------------------------------------------------------------
|
86
|
+
|
87
|
+
FileNotFoundError Traceback (most recent call last)
|
88
|
+
|
89
|
+
<ipython-input-13-2b33876a7cf3> in <module>
|
90
|
+
|
91
|
+
1 import os
|
92
|
+
|
93
|
+
----> 2 print(os.listdir('C:\Users\81809\Desktop\MyPandas'))
|
81
94
|
|
82
95
|
|
83
96
|
|
97
|
+
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\81809\Desktop\MyPandas'
|
84
98
|
|
85
99
|
|
86
100
|
|
101
|
+
↑
|
87
102
|
|
103
|
+
print(os.listdir('C:\Users\81809\Desktop\MyPandas'))
|
88
104
|
|
89
|
-
|
105
|
+
の部分を実行して出てきたエラーです。
|
90
106
|
|
91
107
|
```
|
92
108
|
|
3
名を入力 という余計な文字をを削除した
test
CHANGED
File without changes
|
test
CHANGED
@@ -62,7 +62,7 @@
|
|
62
62
|
|
63
63
|
|
64
64
|
|
65
|
-
NameError: name 'pd' is not defined
|
65
|
+
NameError: name 'pd' is not defined
|
66
66
|
|
67
67
|
↑df_order=pd.read_excel(import_file_path, sheet_name=excel_sheet_name) の部分を実行して出てきたエラー
|
68
68
|
|
2
自分の書いたコードを載せました。また、エラーの内容が変わっていたので乗せなおしました
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,17 +20,17 @@
|
|
20
20
|
|
21
21
|
import openpyxl
|
22
22
|
|
23
|
-
↑ここまでは実行しても何も起こらなかった
|
24
|
-
|
25
23
|
|
26
24
|
|
27
25
|
import pandas as pd
|
28
26
|
|
29
27
|
import glob
|
30
28
|
|
31
|
-
|
29
|
+
↑ここまでは実行しても何も起こらなかった
|
32
30
|
|
33
31
|
|
32
|
+
|
33
|
+
import_file_path='C:\Users\8***9\Desktop\MyPandas\sample.xlsx'
|
34
34
|
|
35
35
|
excel_sheet_name='発注管理'
|
36
36
|
|
@@ -38,7 +38,11 @@
|
|
38
38
|
|
39
39
|
|
40
40
|
|
41
|
+
df_order=pd.read_excel(import_file_path, sheet_name=excel_sheet_name)
|
42
|
+
|
43
|
+
|
44
|
+
|
41
|
-
という部分
|
45
|
+
という部分を実行したところ、下記のようなエラーが出ました。
|
42
46
|
|
43
47
|
```
|
44
48
|
|
@@ -48,101 +52,39 @@
|
|
48
52
|
|
49
53
|
|
50
54
|
|
51
|
-
```ここに言語
|
55
|
+
```ここに言語---------------------------------------------------------------------------
|
52
56
|
|
53
|
-
|
57
|
+
NameError Traceback (most recent call last)
|
54
58
|
|
55
|
-
<ipython-input-
|
59
|
+
<ipython-input-4-c264f38fd98d> in <module>
|
56
60
|
|
57
61
|
----> 1 df_order=pd.read_excel(import_file_path, sheet_name=excel_sheet_name)
|
58
62
|
|
59
63
|
|
60
64
|
|
61
|
-
|
65
|
+
NameError: name 'pd' is not defined名を入力
|
62
66
|
|
63
|
-
186 else:
|
64
|
-
|
65
|
-
|
67
|
+
↑df_order=pd.read_excel(import_file_path, sheet_name=excel_sheet_name) の部分を実行して出てきたエラー
|
66
|
-
|
67
|
-
--> 188 return func(*args, **kwargs)
|
68
|
-
|
69
|
-
189 return wrapper
|
70
|
-
|
71
|
-
190 return _deprecate_kwarg
|
72
68
|
|
73
69
|
|
74
70
|
|
75
|
-
|
71
|
+
追記)なぜか、この質問をするきっかけとなった
|
76
72
|
|
77
|
-
|
73
|
+
import_file_path='C:\Users\8***9\Desktop\MyPandas\sample.xlsx'
|
78
74
|
|
79
|
-
|
75
|
+
excel_sheet_name='発注管理'
|
80
76
|
|
81
|
-
|
77
|
+
export_file_path='C:\Users\8***9\Desktop\MyPandas\output' の部分は実行してもエラーがなくなっていました
|
82
|
-
|
83
|
-
189 return wrapper
|
84
|
-
|
85
|
-
190 return _deprecate_kwarg
|
86
78
|
|
87
79
|
|
88
80
|
|
89
|
-
~/anaconda3/lib/python3.7/site-packages/pandas/io/excel.py in read_excel(io, sheet_name, header, names, index_col, parse_cols, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, verbose, parse_dates, date_parser, thousands, comment, skip_footer, skipfooter, convert_float, mangle_dupe_cols, **kwds)
|
90
|
-
|
91
|
-
348
|
92
|
-
|
93
|
-
349 if not isinstance(io, ExcelFile):
|
94
|
-
|
95
|
-
--> 350 io = ExcelFile(io, engine=engine)
|
96
|
-
|
97
|
-
351
|
98
|
-
|
99
|
-
352 return io.parse(
|
100
81
|
|
101
82
|
|
102
83
|
|
103
|
-
~/anaconda3/lib/python3.7/site-packages/pandas/io/excel.py in __init__(self, io, engine)
|
104
|
-
|
105
|
-
651 self._io = _stringify_path(io)
|
106
|
-
|
107
|
-
652
|
108
|
-
|
109
|
-
--> 653 self._reader = self._engines[engine](self._io)
|
110
|
-
|
111
|
-
654
|
112
|
-
|
113
|
-
655 def __fspath__(self):
|
114
84
|
|
115
85
|
|
116
86
|
|
117
|
-
~/anaconda3/lib/python3.7/site-packages/pandas/io/excel.py in __init__(self, filepath_or_buffer)
|
118
87
|
|
119
|
-
422 self.book = xlrd.open_workbook(file_contents=data)
|
120
|
-
|
121
|
-
423 elif isinstance(filepath_or_buffer, compat.string_types):
|
122
|
-
|
123
|
-
--> 424 self.book = xlrd.open_workbook(filepath_or_buffer)
|
124
|
-
|
125
|
-
425 else:
|
126
|
-
|
127
|
-
426 raise ValueError('Must explicitly set engine if not passing in'
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
~/anaconda3/lib/python3.7/site-packages/xlrd/__init__.py in open_workbook(filename, logfile, verbosity, use_mmap, file_contents, encoding_override, formatting_info, on_demand, ragged_rows)
|
132
|
-
|
133
|
-
109 else:
|
134
|
-
|
135
|
-
110 filename = os.path.expanduser(filename)
|
136
|
-
|
137
|
-
--> 111 with open(filename, "rb") as f:
|
138
|
-
|
139
|
-
112 peek = f.read(peeksz)
|
140
|
-
|
141
|
-
113 if peek == b"PK\x03\x04": # a ZIP file
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
FileNotFoundError: [Errno 2]
|
146
88
|
|
147
89
|
|
148
90
|
|
1
エラーを全て載せました。 また、自分が動画の中の指示に従って書いたコードも全て載せました
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,6 +14,20 @@
|
|
14
14
|
|
15
15
|
```
|
16
16
|
|
17
|
+
!pip install openpyxl
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
import openpyxl
|
22
|
+
|
23
|
+
↑ここまでは実行しても何も起こらなかった
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
import pandas as pd
|
28
|
+
|
29
|
+
import glob
|
30
|
+
|
17
31
|
import_file_path='C:\Users\8***9\Desktop\MyPandas\sample.xlsx'
|
18
32
|
|
19
33
|
|
@@ -24,7 +38,7 @@
|
|
24
38
|
|
25
39
|
|
26
40
|
|
27
|
-
という部分を実行したところ、下記のようなエラーが出ました。
|
41
|
+
という部分の三行を実行したところ、下記のようなエラーが出ました。
|
28
42
|
|
29
43
|
```
|
30
44
|
|
@@ -36,7 +50,99 @@
|
|
36
50
|
|
37
51
|
```ここに言語名を入力
|
38
52
|
|
39
|
-
FileNotFoundError
|
53
|
+
FileNotFoundError Traceback (most recent call last)
|
54
|
+
|
55
|
+
<ipython-input-5-c264f38fd98d> in <module>
|
56
|
+
|
57
|
+
----> 1 df_order=pd.read_excel(import_file_path, sheet_name=excel_sheet_name)
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
~/anaconda3/lib/python3.7/site-packages/pandas/util/_decorators.py in wrapper(*args, **kwargs)
|
62
|
+
|
63
|
+
186 else:
|
64
|
+
|
65
|
+
187 kwargs[new_arg_name] = new_arg_value
|
66
|
+
|
67
|
+
--> 188 return func(*args, **kwargs)
|
68
|
+
|
69
|
+
189 return wrapper
|
70
|
+
|
71
|
+
190 return _deprecate_kwarg
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
~/anaconda3/lib/python3.7/site-packages/pandas/util/_decorators.py in wrapper(*args, **kwargs)
|
76
|
+
|
77
|
+
186 else:
|
78
|
+
|
79
|
+
187 kwargs[new_arg_name] = new_arg_value
|
80
|
+
|
81
|
+
--> 188 return func(*args, **kwargs)
|
82
|
+
|
83
|
+
189 return wrapper
|
84
|
+
|
85
|
+
190 return _deprecate_kwarg
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
~/anaconda3/lib/python3.7/site-packages/pandas/io/excel.py in read_excel(io, sheet_name, header, names, index_col, parse_cols, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, verbose, parse_dates, date_parser, thousands, comment, skip_footer, skipfooter, convert_float, mangle_dupe_cols, **kwds)
|
90
|
+
|
91
|
+
348
|
92
|
+
|
93
|
+
349 if not isinstance(io, ExcelFile):
|
94
|
+
|
95
|
+
--> 350 io = ExcelFile(io, engine=engine)
|
96
|
+
|
97
|
+
351
|
98
|
+
|
99
|
+
352 return io.parse(
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
~/anaconda3/lib/python3.7/site-packages/pandas/io/excel.py in __init__(self, io, engine)
|
104
|
+
|
105
|
+
651 self._io = _stringify_path(io)
|
106
|
+
|
107
|
+
652
|
108
|
+
|
109
|
+
--> 653 self._reader = self._engines[engine](self._io)
|
110
|
+
|
111
|
+
654
|
112
|
+
|
113
|
+
655 def __fspath__(self):
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
~/anaconda3/lib/python3.7/site-packages/pandas/io/excel.py in __init__(self, filepath_or_buffer)
|
118
|
+
|
119
|
+
422 self.book = xlrd.open_workbook(file_contents=data)
|
120
|
+
|
121
|
+
423 elif isinstance(filepath_or_buffer, compat.string_types):
|
122
|
+
|
123
|
+
--> 424 self.book = xlrd.open_workbook(filepath_or_buffer)
|
124
|
+
|
125
|
+
425 else:
|
126
|
+
|
127
|
+
426 raise ValueError('Must explicitly set engine if not passing in'
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
~/anaconda3/lib/python3.7/site-packages/xlrd/__init__.py in open_workbook(filename, logfile, verbosity, use_mmap, file_contents, encoding_override, formatting_info, on_demand, ragged_rows)
|
132
|
+
|
133
|
+
109 else:
|
134
|
+
|
135
|
+
110 filename = os.path.expanduser(filename)
|
136
|
+
|
137
|
+
--> 111 with open(filename, "rb") as f:
|
138
|
+
|
139
|
+
112 peek = f.read(peeksz)
|
140
|
+
|
141
|
+
113 if peek == b"PK\x03\x04": # a ZIP file
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
FileNotFoundError: [Errno 2]
|
40
146
|
|
41
147
|
|
42
148
|
|