0

I can't apply these filters to the self.symbol_dataframe:

self.symbols_dataframe_stc_stocks = self.symbols_dataframe[(self.symbols_dataframe['categoryName'] == 'STC') and (self.symbols_dataframe['categoryName'] == 'STK') and (self.symbols_dataframe['levarage'] == 100.)]
self.symbols_dataframe_cfd_stocks = self.symbols_dataframe[(self.symbols_dataframe['categoryName'] == 'STC') and (self.symbols_dataframe['categoryName'] == 'STK') and (self.symbols_dataframe['levarage'] != 100.)]

The object has following datatypes:

symbol                 object
currency               object
categoryName           object
currencyProfit         object
quoteId                 int64
quoteIdCross            int64
marginMode              int64
profitMode              int64
pipsPrecision           int64
contractSize            int64
exemode                 int64
time                    int64
expiration             object
stopsLevel              int64
precision               int64
swapType                int64
stepRuleId              int64
type                    int64
instantMaxVolume        int64
groupName              object
description            object
longOnly                 bool
trailingEnabled          bool
marginHedgedStrong       bool
swapEnable               bool
percentage            float64
bid                   float64
ask                   float64
high                  float64
low                   float64
lotMin                float64
lotMax                float64
lotStep               float64
tickSize              float64
tickValue             float64
swapLong              float64
swapShort             float64
leverage              float64
spreadRaw             float64
spreadTable           float64
starting               object
swap_rollover3days      int64
marginMaintenance       int64
marginHedged            int64
initialMargin           int64
shortSelling             bool
timeString             object
currencyPair             bool
dtype: object

I got the following error:

Traceback (most recent call last):
  File "C:\Users\...\AppData\Local\Programs\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner
    self.run()
  File "C:\Users\...\AppData\Local\Programs\Python\Python39\lib\threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\...\PycharmProjects\LSTM_multiple_indicators\UI.py", line 353, in getAllSymbols_xtb_api
    self.symbols_dataframe_stc_stocks = self.symbols_dataframe[(self.symbols_dataframe['categoryName'] == 'STC') and (self.symbols_dataframe['categoryName'] == 'STK') and (self.symbols_dataframe['levarage'] == 100.)]
  File "C:\Users\...\PycharmProjects\LSTM_multiple_indicators\venv\lib\site-packages\pandas\core\generic.py", line 1527, in __nonzero__
    raise ValueError(
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

How do I fix these, I have no clue why these filter might return boolean instead of a new dataframe with filtered values.

Thanks for your help in advance :)

0 Answers0