質問編集履歴
1
プログラム、実行結果を更新しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -44,13 +44,23 @@
|
|
44
44
|
|
45
45
|
```python
|
46
46
|
|
47
|
-
|
47
|
+
import pandas as pd
|
48
48
|
|
49
|
-
|
49
|
+
df = pd.read_csv('/home/pi/dev/data/temp.csv', names=['year', 'month', 'day', 'hour', 'minute', 'temperature'])
|
50
50
|
|
51
|
-
|
51
|
+
max=df['temperature'].max()
|
52
52
|
|
53
|
+
start=df.iloc[0:1,0:5]
|
54
|
+
|
55
|
+
end=df.iloc[49:50,0:5]
|
56
|
+
|
57
|
+
print (start)
|
58
|
+
|
59
|
+
print (end)
|
60
|
+
|
61
|
+
print (df[df['temperature'].max() == max])
|
62
|
+
|
53
|
-
|
63
|
+
print ('最高温度:'+ '{:.3f}'.format(max))
|
54
64
|
|
55
65
|
```
|
56
66
|
|
@@ -81,3 +91,41 @@
|
|
81
91
|
2019,10,31,13,13,23.233754307
|
82
92
|
|
83
93
|
```
|
94
|
+
|
95
|
+
##実行エラー
|
96
|
+
|
97
|
+
```text
|
98
|
+
|
99
|
+
year month day hour minute
|
100
|
+
|
101
|
+
0 2019 10 31 13 55
|
102
|
+
|
103
|
+
year month day hour minute
|
104
|
+
|
105
|
+
49 2019 10 31 15 9
|
106
|
+
|
107
|
+
Traceback (most recent call last):
|
108
|
+
|
109
|
+
File "./test.py", line 13, in <module>
|
110
|
+
|
111
|
+
print (df[df['temperature'].max() == max])
|
112
|
+
|
113
|
+
File "/home/pi/.local/lib/python2.7/site-packages/pandas/core/frame.py", line 2927, in __getitem__
|
114
|
+
|
115
|
+
indexer = self.columns.get_loc(key)
|
116
|
+
|
117
|
+
File "/home/pi/.local/lib/python2.7/site-packages/pandas/core/indexes/base.py", line 2659, in get_loc
|
118
|
+
|
119
|
+
return self._engine.get_loc(self._maybe_cast_indexer(key))
|
120
|
+
|
121
|
+
File "pandas/_libs/index.pyx", line 108, in pandas._libs.index.IndexEngine.get_loc
|
122
|
+
|
123
|
+
File "pandas/_libs/index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc
|
124
|
+
|
125
|
+
File "pandas/_libs/hashtable_class_helper.pxi", line 1601, in pandas._libs.hashtable.PyObjectHashTable.get_item
|
126
|
+
|
127
|
+
File "pandas/_libs/hashtable_class_helper.pxi", line 1608, in pandas._libs.hashtable.PyObjectHashTable.get_item
|
128
|
+
|
129
|
+
KeyError: True
|
130
|
+
|
131
|
+
```
|