I am trying to reuse the defined function for multiple rows in a data frame. But I am getting an error "No axis named Stats for object type DataFrame"