Remove unused, avoid uses of deprecated api
State: closed

`core.dtypes.common.is_period` is confusingly named and never used.  This PR gets rid of it.

The deprecated numpy API that causes zillions of warnings includes `ndarray.data`, so this replaces the old usage with the encouraged usage.

A bunch of `tslibs.util` isn't actually used in tslibs.util, so the relevant functions are moved up to `_libs.util`.

Docstrings for most of what's left in tslibs.util.

Simplify util._checknull by removing an unnecessary try/except.

Labels:
name: Internals
description: Related to non-user accessible pandas implementation
name: Clean

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22071?src=pr&el=h1) Report
> Merging [#22071](https://codecov.io/gh/pandas-dev/pandas/pull/22071?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/d30c4a0696d5fbdc3c7ce36a9b9b19224a557e09?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/22071/graphs/tree.svg?width=650&height=150&token=eZ4WkYLtcO&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/22071?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #22071   +/-   ##
=======================================
  Coverage   92.07%   92.07%           
=======================================
  Files         170      170           
  Lines       50690    50690           
=======================================
  Hits        46672    46672           
  Misses       4018     4018
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.48% <ø> (ø)` | :arrow_up: |
| #single | `42.31% <ø> (ø)` | :arrow_up: |


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22071?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22071?src=pr&el=footer). Last update [d30c4a0...e6fa730](https://codecov.io/gh/pandas-dev/pandas/pull/22071?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

> we are numpy >= 1.9! can this be simplified?

An update/background on the ever-present numpy deprecation warnings.  Based on conversation on the cython [tracker](https://github.com/cython/cython/issues/2498) it looks like

a) numpy more or less forgot why they did that deprecation, have no plans to follow up on it
b) this _could_ be fixed in cython; I'll keep an eye on it but no one should hold their breath
c) _if_ this is fixed in cython, pandas has a handful of places that uses the old API that will need to be updated (many/most of which this PR does)

AFAICT we get the deprecation warning if we do one or more of:
i) cimport numpy as cnp
ii) from numpy cimport ...
iii) `cdef extern from ...` any file that has an `#include <numpy/...>`
iii) b) _unless_ we add to that file the lines:

```
#ifndef
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#endif
```

iii) c) But any C file we add this to becomes off-limits for cython files that have numpy cimports (or else we get compile-time errors)

----
The upshot being: there are a bunch of files for which we can get rid of these warnings.

Many of the files only  have numpy cimports because they need to a) call `import_array` in order to use `util.is_integer_object`, b) need `int64_t`, or c) need `ndarray`.

These can all be worked around if we get numpy cimports out of util (which this PR does)
the warnings in the log seem more than before on interval.pyx. but could be just me.
> the warnings in the log seem more than before on interval.pyx. but could be just me.

A couple PRs back that fixed a bunch of warnings, changes to interval.pyx were reverted because they caused failures on windows.  So this file has been cleaned up much less than the others, might seem like more in comparison.
thanks!