Trying to rewrite all the functions with Pandas