質問編集履歴
4
コード追加
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
エラー
|
1
|
+
groupbyメソッド 不定義エラー
|
test
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
+
エラー内容を見ると(不定義)とのことだと思うのですが。
|
2
|
+
|
1
|
-
|
3
|
+
スペル間違い。半角等の再度見直し済。
|
2
4
|
|
3
5
|
|
4
6
|
|
@@ -6,111 +8,9 @@
|
|
6
8
|
|
7
9
|
コード
|
8
10
|
|
9
|
-
!pip install numpy
|
10
|
-
|
11
|
-
import numpy as np
|
12
|
-
|
13
|
-
↓
|
14
|
-
|
15
|
-
import pandas as pd
|
16
|
-
|
17
|
-
↓
|
18
|
-
|
19
|
-
df_population_data = pd.read_csv('data.csv',encoding='shift-jis')
|
20
|
-
|
21
|
-
↓
|
22
|
-
|
23
|
-
df_population_data
|
24
|
-
|
25
|
-
↓
|
26
|
-
|
27
|
-
type(df_population_data)
|
28
|
-
|
29
|
-
↓
|
30
|
-
|
31
|
-
pd.reset_option('display.max_rows',1000)#最大表示行数
|
32
|
-
|
33
|
-
↓
|
34
|
-
|
35
|
-
df_population_data
|
36
|
-
|
37
|
-
↓
|
38
|
-
|
39
|
-
pd.reset_option('display.max_rows')
|
40
|
-
|
41
|
-
↓
|
42
|
-
|
43
|
-
df_population_data
|
44
|
-
|
45
|
-
↓
|
46
|
-
|
47
|
-
pd.set_option('display.max_rows',5)#最大表示行数
|
48
|
-
|
49
|
-
↓
|
50
|
-
|
51
|
-
df_population_data
|
52
|
-
|
53
|
-
↓
|
54
|
-
|
55
|
-
pd.reset_option('display.max_columns')
|
56
|
-
|
57
|
-
↓
|
58
|
-
|
59
|
-
df_population_data
|
60
|
-
|
61
|
-
↓
|
62
|
-
|
63
|
-
df_population_data.head()
|
64
|
-
|
65
|
-
↓
|
66
|
-
|
67
|
-
df_population_data.head(10)
|
68
|
-
|
69
|
-
↓
|
70
|
-
|
71
|
-
df_population_data.tail(10)
|
72
|
-
|
73
|
-
↓
|
74
|
-
|
75
|
-
df_population_data.sample(10)
|
76
|
-
|
77
|
-
↓
|
78
|
-
|
79
|
-
df_population_data.info()
|
80
|
-
|
81
|
-
↓
|
82
|
-
|
83
|
-
df_population_data.describe()
|
84
|
-
|
85
|
-
↓
|
86
|
-
|
87
|
-
df_population_data.describe().round(0)
|
88
|
-
|
89
|
-
↓
|
90
|
-
|
91
|
-
df_population_data.groupby(by='都道府県名').mean()[['人口(総数)', '人口(男)', '人口(女)']].round(0)
|
92
|
-
|
93
|
-
(エラー)
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
11
|
実行内容
|
112
12
|
|
113
|
-
df_population_data.grou
|
13
|
+
df_population_data.grouby(by='都道府県名').mean()[['人口(総数)','人口(男)','人口(女)']].round(0)
|
114
14
|
|
115
15
|
|
116
16
|
|
@@ -118,12 +18,30 @@
|
|
118
18
|
|
119
19
|
NameError Traceback (most recent call last)
|
120
20
|
|
121
|
-
<ipython-input-
|
21
|
+
<ipython-input-2-d86aa243cb8e> in <module>
|
122
22
|
|
123
|
-
----> 1 df_population_data.grou
|
23
|
+
----> 1 df_population_data.grouby(by='都道府県名').mean()[['人口(総数)','人口(男)','人口(女)']].round(0)
|
124
24
|
|
125
25
|
|
126
26
|
|
127
27
|
NameError: name 'df_population_data' is not defined
|
128
28
|
|
29
|
+
|
30
|
+
|
31
|
+
以下のコードは、エラー無く通ります。
|
32
|
+
|
33
|
+
python
|
34
|
+
|
35
|
+
import numpy as np
|
36
|
+
|
37
|
+
import pandas as pd
|
38
|
+
|
39
|
+
df_population_data = pd.read_csv('data.csv',encoding='shift-jis')
|
40
|
+
|
41
|
+
df_population_data
|
42
|
+
|
43
|
+
```ここに言語を入力
|
44
|
+
|
45
|
+
コード
|
46
|
+
|
129
47
|
```
|
3
コード追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -108,7 +108,7 @@
|
|
108
108
|
|
109
109
|
|
110
110
|
|
111
|
-
|
111
|
+
実行内容
|
112
112
|
|
113
113
|
df_population_data.groupby(by='都道府県名').mean()[['人口(総数)', '人口(男)', '人口(女)']].round(0)
|
114
114
|
|
@@ -116,8 +116,14 @@
|
|
116
116
|
|
117
117
|
エラー内容
|
118
118
|
|
119
|
-
NameError
|
119
|
+
NameError Traceback (most recent call last)
|
120
|
+
|
121
|
+
<ipython-input-1-9470f8bfc389> in <module>
|
122
|
+
|
123
|
+
----> 1 df_population_data.groupby(by='都道府県名').mean()[['人口(総数)', '人口(男)', '人口(女)']].round(0)
|
120
124
|
|
121
125
|
|
122
126
|
|
127
|
+
NameError: name 'df_population_data' is not defined
|
128
|
+
|
123
129
|
```
|
2
コード追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -5,6 +5,110 @@
|
|
5
5
|
```python
|
6
6
|
|
7
7
|
コード
|
8
|
+
|
9
|
+
!pip install numpy
|
10
|
+
|
11
|
+
import numpy as np
|
12
|
+
|
13
|
+
↓
|
14
|
+
|
15
|
+
import pandas as pd
|
16
|
+
|
17
|
+
↓
|
18
|
+
|
19
|
+
df_population_data = pd.read_csv('data.csv',encoding='shift-jis')
|
20
|
+
|
21
|
+
↓
|
22
|
+
|
23
|
+
df_population_data
|
24
|
+
|
25
|
+
↓
|
26
|
+
|
27
|
+
type(df_population_data)
|
28
|
+
|
29
|
+
↓
|
30
|
+
|
31
|
+
pd.reset_option('display.max_rows',1000)#最大表示行数
|
32
|
+
|
33
|
+
↓
|
34
|
+
|
35
|
+
df_population_data
|
36
|
+
|
37
|
+
↓
|
38
|
+
|
39
|
+
pd.reset_option('display.max_rows')
|
40
|
+
|
41
|
+
↓
|
42
|
+
|
43
|
+
df_population_data
|
44
|
+
|
45
|
+
↓
|
46
|
+
|
47
|
+
pd.set_option('display.max_rows',5)#最大表示行数
|
48
|
+
|
49
|
+
↓
|
50
|
+
|
51
|
+
df_population_data
|
52
|
+
|
53
|
+
↓
|
54
|
+
|
55
|
+
pd.reset_option('display.max_columns')
|
56
|
+
|
57
|
+
↓
|
58
|
+
|
59
|
+
df_population_data
|
60
|
+
|
61
|
+
↓
|
62
|
+
|
63
|
+
df_population_data.head()
|
64
|
+
|
65
|
+
↓
|
66
|
+
|
67
|
+
df_population_data.head(10)
|
68
|
+
|
69
|
+
↓
|
70
|
+
|
71
|
+
df_population_data.tail(10)
|
72
|
+
|
73
|
+
↓
|
74
|
+
|
75
|
+
df_population_data.sample(10)
|
76
|
+
|
77
|
+
↓
|
78
|
+
|
79
|
+
df_population_data.info()
|
80
|
+
|
81
|
+
↓
|
82
|
+
|
83
|
+
df_population_data.describe()
|
84
|
+
|
85
|
+
↓
|
86
|
+
|
87
|
+
df_population_data.describe().round(0)
|
88
|
+
|
89
|
+
↓
|
90
|
+
|
91
|
+
df_population_data.groupby(by='都道府県名').mean()[['人口(総数)', '人口(男)', '人口(女)']].round(0)
|
92
|
+
|
93
|
+
(エラー)
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
8
112
|
|
9
113
|
df_population_data.groupby(by='都道府県名').mean()[['人口(総数)', '人口(男)', '人口(女)']].round(0)
|
10
114
|
|
1
言語追加
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|