Thank you to all that responded. I did try doing all the filtering outside of polars but it turned out to be really un wieldy, which is why I was trying to do it in Polars. When I thought about it some more I realised that some of the filtering was not required. But in the end I came up with a solution, as follows:
self.configs_df = self.configs_df.filter(
((pl.col('Ticker') == ticker) | (pl.lit(ticker) == pl.lit('')))
& ((pl.col('Iteration') == iteration) | (pl.lit(iteration) == pl.lit(-1)))
)
I think the original problem was that I was trying to do something like this:
(ticker != '' & ...
which is what other people suggested. I think the trick was to use
pl.lit(ticker) == pl.lit('')
instead. So, I managed to resolve my problem, and I hope this helps anyone else that may have a similar problem. Thanks all that contributed.
Regards, Stuart