BUG: fix NPY_NO_DEPRECATED_API mechanism.
Merge pull request #3024 from rgommers/fix-api-deprecation

BUG: fix NPY_NO_DEPRECATED_API mechanism.