format number is not recognized in a cycle
Peter Otten
__peter__ at web.de
Mon Feb 4 14:59:37 EST 2019
Diego Avesani wrote:
> Dear Peter, Deal all,
>
> Trying different options, I manage this solution:
>
> mask = (df['datatime'] > str(start_date[ii])) & (df['datatime'] <=
> str(end_date[ii]))
>
> As you can notice, I have put str before start_date[ii]) and end_date[ii].
>
> What do you think?
Don't use your workaround unless you have ensured that
you get the correct result. Comparisons between arbitrary types are
dangerous in Python 2:
>>> "10" > 1
True
>>> "1" > 1
True
>>> "0" > 1
True
Perhaps you can find a better approach when you post your problem in a
forum dedicated to pandas.
More information about the Python-list
mailing list