I recently noticed that the function where I repeat the lines DataFrameusing .ilocis very slow. I found out that there is a faster method called .iatthat is considered equivalent .iloc. I tried, and it reduced the runtime by about 75%.
But I'm a bit hesitant: why is there an "equivalent" method that is faster? There must be some difference between the inner workings of the two and the reason why they both exist, and not just faster. I tried searching everywhere, but even the pandas documentation says that
DataFrame.iat
Fast integer scalar location.
Like iloc, iat provides an integer search. You can also set these indexes.
And it doesn’t help.
Are there any restrictions on use .iat? Why faster; is it sloppier? Or am I just switching to .iatand happily forget an .ilocever existing one?
source
share