BUG: clip doesn't preserve dtype by column
State: closed

- [x] closes #24162
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

```python3
>>> import pandas as pd
>>> data = pd.DataFrame([[1, 2], [3, 4]], columns=['int1', 'int2'])
>>> data.clip_upper(1)
__main__:1: FutureWarning: clip_upper(threshold) is deprecated, use clip(upper=threshold) instead
   int1  int2
0     1     1
1     1     1
```
**Before**
```python3
>>> data['float'] = data['int1'].astype(float)
>>> data.clip_upper(1)
   int1  int2  float
0   1.0   1.0    1.0
1   1.0   1.0    1.0
```
**After**
```python3
>>> data['float'] = data['int1'].astype(float)
>>> data.clip_upper(1)
   int1  int2  float
0     1     1    1.0
1     1     1    1.0
```

Labels:
name: Bug
name: Dtype Conversions
description: Unexpected or buggy dtype conversions

Comments:
looks pretty good - pls add. whatsnew note
can u ensure that the OP test is covered?

i suspect we have a couple of open issues for clip that might be closed by this as well

if u can have a look
#20911 and #21476 maybe
> #20911 and #21476 maybe
Thanks @jreback sure let me check them out!
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24458?src=pr&el=h1) Report
> Merging [#24458](https://codecov.io/gh/pandas-dev/pandas/pull/24458?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/24a50fc3028ff52ab37ea38911f34c05a746181c?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #24458      +/-   ##
==========================================
- Coverage   92.29%   92.29%   -0.01%     
==========================================
  Files         163      163              
  Lines       51969    51964       -5     
==========================================
- Hits        47967    47962       -5     
  Misses       4002     4002
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.7% <100%> (-0.01%)` | :arrow_down: |
| #single | `43.02% <0%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24458?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/24458/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `96.62% <100%> (-0.01%)` | :arrow_down: |

------

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

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24458?src=pr&el=h1) Report
> Merging [#24458](https://codecov.io/gh/pandas-dev/pandas/pull/24458?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/24a50fc3028ff52ab37ea38911f34c05a746181c?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #24458      +/-   ##
==========================================
- Coverage   92.29%   92.29%   -0.01%     
==========================================
  Files         163      163              
  Lines       51969    51943      -26     
==========================================
- Hits        47967    47940      -27     
- Misses       4002     4003       +1
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.7% <100%> (-0.01%)` | :arrow_down: |
| #single | `43% <0%> (-0.02%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24458?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/24458/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `96.62% <100%> (-0.01%)` | :arrow_down: |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/24458/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `97.56% <0%> (-0.15%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/24458/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `96.2% <0%> (-0.11%)` | :arrow_down: |
| [pandas/core/indexes/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/24458/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9wZXJpb2QucHk=) | `92.71% <0%> (-0.05%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24458/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `87.75% <0%> (ø)` | :arrow_up: |
| [pandas/core/indexes/accessors.py](https://codecov.io/gh/pandas-dev/pandas/pull/24458/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9hY2Nlc3NvcnMucHk=) | `91% <0%> (ø)` | :arrow_up: |
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/24458/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `90.28% <0%> (+0.16%)` | :arrow_up: |

------

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

@jreback,

had look at #20911, I think that's not a supported use case when passing a `DataFrame` for either `lower` or `upper`, which is essentially used as a numpy array for creating a mask, having ignored the column orders. 

#21476 is to do with different precisions between s and threshold. It works fine downcasting from int to float but appears not from float32 to float64. I suspect it's to do with numpy and need more investigation.
```python
>>> df.clip(lower=2, upper=7)
   floats  int
0     2.0    2
1     2.0    2
2     2.2    2
3     3.3    3
4     4.4    4
5     5.5    5
6     6.6    6
7     7.0    7
8     7.0    7
9     7.0    7

>>> df.clip(lower=2, upper=7.5)
   floats  int
0     2.0  2.0
1     2.0  2.0
2     2.2  2.0
3     3.3  3.0
4     4.4  4.0
5     5.5  5.0
6     6.6  6.0
7     7.5  7.0
8     7.5  7.5
9     7.5  7.5
```
@jreback 

review actioned and added test and documentation.
thanks. ping on green.
@jreback  thanks, it's green.
thanks @minggli 
@jreback @mroeschke thanks for reviewing and happy new year!