It seems filtering DataFrames is not compatible with ShiftedArrays in a way one would expect it to be:
using DataFrames
using ShiftedArrays
issquare(n::Integer)=(n==round(sqrt(n))^2)
N=20
numbers=collect(1:N)
successors=ShiftedArrays.lead(numbers)
predecessors=ShiftedArrays.lag(numbers)
Test=DataFrame([numbers,successors,predecessors],[:n,:s,:p])
GoodFiltered=filter!( row->issquare(row.n), Test )
This gives the correct result, for example containing a row with n=9, s=10, p=8
However, when I slightly vary the code and replace the last two lines of code with
Test=DataFrame([numbers],[:n])
Test.s=ShiftedArrays.lead(Test.n)
Test.p=ShiftedArrays.lag(Test.n)
BadFiltered=filter!( row->issquare(row.n), Test )
This gives the wrong result, for example containing a row with n=9, s=16, p=4
It is very unexpected to me, there might be some explanation but it certainly feels like this should not be the way filter! works, especially since filter without ! works well as before.
Thanks for any help!