I got the same error when I used idmax(). The actual function is idxmax(), use this and the error will disappear.