pythonでnumpyのデータとintデータの比較をしたいのですが、うまくいきません
どのようにすればよいでしょうか?
データは次のとおりです
python
1print(width) 2print(splet)
python
1499 0.00357 2Name: close, dtype: float64 30.012999999999991019
このデータをif文で処理したいのですが
python
1if width > splet: 2 print("buy") 3elif (-splet > width) & (width > splet): 4 print('sell') 5else: 6 print('none')
次のようなエラーが出ます
python
1ValueError Traceback (most recent call last) 2<ipython-input-26-69476cce1849> in <module>() 3 4 4 5 5----> 6 if width > splet: 6 7 print("buy") 7 8 elif (-splet > width) & (width > splet): 8 9~\Anaconda3\lib\site-packages\pandas\core\generic.py in __nonzero__(self) 10 1119 raise ValueError("The truth value of a {0} is ambiguous. " 11 1120 "Use a.empty, a.bool(), a.item(), a.any() or a.all()." 12-> 1121 .format(self.__class__.__name__)) 13 1122 14 1123 __bool__ = __nonzero__ 15 16ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
回答3件
あなたの回答
tips
プレビュー