ENH: is_scalar returns True for DateOffset objects
State: closed

- [x] closes #18943
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

I've implemented `is_offset` identically to `is_period_object` and added it to `isscalar` and `is_scalar` is now returning true for DateOffsets. 

But not sure how to go about this exactly:
> `is_offset` should also be imported / tested in `pandas/core/dtypes/common.py`

The other "is" functions that are explicitly imported from inference `is_string_like` and `is_list_like` are used for testing but don't look like they themselves are being tested so I'm not sure what kind of test is needed. The rest of the "is" functions are imported with a wildcard but pylint is telling me they are not used (should I go through and make the required imports explicit?).






Labels:
name: Enhancement
name: API Design

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

```diff
@@           Coverage Diff           @@
##           master   #18982   +/-   ##
=======================================
  Coverage   91.58%   91.58%           
=======================================
  Files         150      150           
  Lines       48967    48967           
=======================================
  Hits        44846    44846           
  Misses       4121     4121
```

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


------

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

Thanks!

It looks like the test for `is_scalar` in `pandas/tests/dtypes/test_inference.py` should be updated, specifically here:
https://github.com/pandas-dev/pandas/blob/4883a432a21e65d998a57708e20196627f7c60d7/pandas/tests/dtypes/test_inference.py#L1150-L1153
Might be nice to add an `assert` statement for `Interval` in addition to `DateOffset`, since it should also return `True` but appears to be untested.

Not 100% sure about your other questions, so I'll let someone else field those instead of potentially saying something that's not right.
Thanks. I should be more clear about the "is" stuff, here is the wildcard import:
https://github.com/pandas-dev/pandas/blob/4883a432a21e65d998a57708e20196627f7c60d7/pandas/core/dtypes/common.py#L16-L17
which I don't think conforms to PEP 8 (?). Just wondering if it's there for a reason or if I should go through and only explicitly export the necessary functions.

Also quick noobie question: when I make changes to pandas locally, I've been running `python setup.py build_ext --inplace -j 4` for my changes to be reflected in the next `import pandas`. Is this the correct way to go about it?
Excessively messed around with rebasing just now, sorry about that!
@gitavi you don't need to rebase. we squash on merge.
thanks @gitavi 
the ``from .inference import *`` is more a convenience thing, it was designed this way.

what I *would* like to change though is to rename ``lib.isscalar`` to ``lib.is_scalar``, for consistency and update the doc-string to be a bit more consistent (e.g. we don't need the 'instances of ....') everything is an instance of.