Check numpy and  pandas import in examples
Fix #23134

Hello @thoo! Thanks for submitting the PR.

 - There are no PEP8 issues in the file [`scripts/tests/test_validate_docstrings.py`](https://github.com/thoo/pandas/blob/5c2f7611879ac93a058994b0be077c0210e34b2d/scripts/tests/test_validate_docstrings.py) !

 - There are no PEP8 issues in the file [`scripts/validate_docstrings.py`](https://github.com/thoo/pandas/blob/5c2f7611879ac93a058994b0be077c0210e34b2d/scripts/validate_docstrings.py) !

 # [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23160?src=pr&el=h1) Report
> Merging [#23160](https://codecov.io/gh/pandas-dev/pandas/pull/23160?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/cf11f71e423be65e9c2ae83ea1bab8b69ee79ca4?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/23160/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/23160?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #23160   +/-   ##
=======================================
  Coverage   92.14%   92.14%           
=======================================
  Files         170      170           
  Lines       51017    51017           
=======================================
  Hits        47011    47011           
  Misses       4006     4006
```

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


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23160?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/23160?src=pr&el=footer). Last update [cf11f71...5c2f761](https://codecov.io/gh/pandas-dev/pandas/pull/23160?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
