前提
データフレームの型変換を行ったのですが、エラーがでてしまいます。
このエラーを無くしたいです。
発生している問題・エラーメッセージ
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) c:\Users\ryous\anacon\lib\site-packages\pandas\core\ops\array_ops.py in na_logical_op(x, y, op) 301 # (xint or xbool) and (yint or bool) --> 302 result = op(x, y) 303 except TypeError: TypeError: unsupported operand type(s) for |: 'float' and 'float' During handling of the above exception, another exception occurred: TypeError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_1200/1396243257.py in <module> 2 #print(dfc[' AU45_c'].dtypes) 3 ----> 4 dfd=dfc[dfc[' AU45_c'] <=0.0] | dfc[dfc["Eye-opening"] <= -6.5] #瞬きのノイズを消去 5 6 plt.figure(figsize=(12,5)) c:\Users\ryous\anacon\lib\site-packages\pandas\core\ops\common.py in new_method(self, other) 67 other = item_from_zerodim(other) 68 ---> 69 return method(self, other) 70 71 return new_method ... c:\Users\ryous\anacon\lib\site-packages\pandas\_libs\ops.pyx in pandas._libs.ops.vec_binop() c:\Users\ryous\anacon\lib\site-packages\pandas\_libs\ops.pyx in pandas._libs.ops.vec_binop() TypeError: unsupported operand type(s) for |: 'float' and 'bool'
該当のソースコード
python
1dfc=dff.astype({' AU45_c':float}) 2#print(dfc[' AU45_c'].dtypes) 実行結果はfloatで型変換はうまくいってます。 3 4dfd=dfc[dfc[' AU45_c'] <=0.0] | dfc[dfc["Eye-opening"] <= -6.5] #瞬きのノイズを消去
回答1件
あなたの回答
tips
プレビュー