質問編集履歴

2

タイトルを変更しました。

2021/10/15 00:31

投稿

skp_1212
skp_1212

スコア0

test CHANGED
@@ -1 +1 @@
1
- エラーの解決方法がわかりません。
1
+ ValueError: Length mismatch: Expected axis has 11 elements, new values have 7 elemenエラーの解決方法がわかりません。
test CHANGED
File without changes

1

実行結果の記載を追記しました。

2021/10/15 00:31

投稿

skp_1212
skp_1212

スコア0

test CHANGED
File without changes
test CHANGED
@@ -47,3 +47,29 @@
47
47
  #CSV出力
48
48
 
49
49
  csv_file = pd.read_csv('/Users/sano/Desktop/earthquake.csv', encoding="utf_8_sig",index_col=0)
50
+
51
+
52
+
53
+ #実行結果
54
+
55
+ Traceback (most recent call last):
56
+
57
+ File "/Users/yousukesano/Desktop/eq.py", line 11, in <module>
58
+
59
+ table.columns = ['Time','Name','Latitude','Longitude','Depth','Magnitude','SeismicIntensity']
60
+
61
+ File "/opt/anaconda3/lib/python3.8/site-packages/pandas/core/generic.py", line 5478, in __setattr__
62
+
63
+ return object.__setattr__(self, name, value)
64
+
65
+ File "pandas/_libs/properties.pyx", line 66, in pandas._libs.properties.AxisProperty.__set__
66
+
67
+ File "/opt/anaconda3/lib/python3.8/site-packages/pandas/core/generic.py", line 670, in _set_axis
68
+
69
+ self._mgr.set_axis(axis, labels)
70
+
71
+ File "/opt/anaconda3/lib/python3.8/site-packages/pandas/core/internals/managers.py", line 220, in set_axis
72
+
73
+ raise ValueError(
74
+
75
+ ValueError: Length mismatch: Expected axis has 11 elements, new values have 7 elements