Indexerror Invalid Index To Scalar Variable. In Python