Speedup using pandas