Convert numpy ndarray to python scalar for single values