質問編集履歴

1

エラーコード詳細の追加

2022/10/18 12:29

投稿

NMKN
NMKN

スコア8

test CHANGED
File without changes
test CHANGED
@@ -12,7 +12,38 @@
12
12
  ### 発生している問題・エラーメッセージ
13
13
 
14
14
  ```
15
- x and y must have same first dimension, but have shapes (1048576,) and (1048575,)
15
+ ---------------------------------------------------------------------------
16
+ KeyError Traceback (most recent call last)
17
+ Input In [2], in <cell line: 5>()
18
+ 3 """df=pd.read_csv('csv in/observationdata.csv',names=['time','voltage'])"""
19
+ 4 df=pd.read_csv('csv in/observationdata.csv')
20
+ ----> 5 df[(df["time"])]
21
+ 6 t=df['time']
22
+ 7 f=df['voltage'] # 変更部分
23
+
24
+ File ~/miniforge3/envs/test1/lib/python3.9/site-packages/pandas/core/frame.py:3511, in DataFrame.__getitem__(self, key)
25
+ 3509 if is_iterator(key):
26
+ 3510 key = list(key)
27
+ -> 3511 indexer = self.columns._get_indexer_strict(key, "columns")[1]
28
+ 3513 # take() does not accept boolean indexers
29
+ 3514 if getattr(indexer, "dtype", None) == bool:
30
+
31
+ File ~/miniforge3/envs/test1/lib/python3.9/site-packages/pandas/core/indexes/base.py:5782, in Index._get_indexer_strict(self, key, axis_name)
32
+ 5779 else:
33
+ 5780 keyarr, indexer, new_indexer = self._reindex_non_unique(keyarr)
34
+ -> 5782 self._raise_if_missing(keyarr, indexer, axis_name)
35
+ 5784 keyarr = self.take(indexer)
36
+ 5785 if isinstance(key, Index):
37
+ 5786 # GH 42790 - Preserve name from an Index
38
+
39
+ File ~/miniforge3/envs/test1/lib/python3.9/site-packages/pandas/core/indexes/base.py:5842, in Index._raise_if_missing(self, key, indexer, axis_name)
40
+ 5840 if use_interval_msg:
41
+ 5841 key = list(key)
42
+ -> 5842 raise KeyError(f"None of [{key}] are in the [{axis_name}]")
43
+ 5844 not_found = list(ensure_index(key)[missing_mask.nonzero()[0]].unique())
44
+ 5845 raise KeyError(f"{not_found} not in index")
45
+
46
+ KeyError: "None of [Float64Index([ 0.0, 5e-06, 1e-05, 1.5e-05, 2e-05, 2.5e-05,\n 3e-05, 3.5e-05, 4e-05, 4.5e-05,\n ...\n 5.242825, 5.24283, 5.242835, 5.24284, 5.242845, 5.24285,\n 5.242855, 5.24286, 5.242865, 5.24287],\n dtype='float64', length=1048575)] are in the [columns]"
16
47
  ```
17
48
 
18
49
  ### 該当のソースコード