Bug : Fixes #20911
State: closed

- [x] closes #20911
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

**Before**
```python
In [1]: import pandas as pd                                                                   

In [2]: df1 = pd.DataFrame([[1., 0.], [3., 0.]], columns=['A', 'B']) 
   ...:                                                                                       

In [3]: df2 = pd.DataFrame([[100., 1.], [100., 2.]], columns=['B', 'A']) 
   ...:                                                                                       

In [4]: df1                                                                                   
Out[4]: 
     A    B
0  1.0  0.0
1  3.0  0.0

In [5]: df2                                                                                   
Out[5]: 
       B    A
0  100.0  1.0
1  100.0  2.0

In [6]: df1.clip(lower=0,upper=df2)                                                           
Out[6]: 
       A    B
0    1.0  0.0
1  100.0  0.0

```
**After**
```python
In [5]: df1.clip(lower=0,upper=df2)                                                           
Out[5]: 
     A    B
0  1.0  0.0
1  2.0  0.0


```


Labels:
name: Bug
name: Numeric Operations
description: Arithmetic, Comparison, and Logical operations

Comments:
Hello @cgangwar11! Thanks for updating the PR.





Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on December 28, 2018 at 22:56 Hours UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24467?src=pr&el=h1) Report
> Merging [#24467](https://codecov.io/gh/pandas-dev/pandas/pull/24467?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/aa1549f7fd8ce81bf23296bf92fe9713aa8d6e20?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

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

```diff
@@           Coverage Diff           @@
##           master   #24467   +/-   ##
=======================================
  Coverage    92.3%    92.3%           
=======================================
  Files         163      163           
  Lines       51969    51969           
=======================================
  Hits        47968    47968           
  Misses       4001     4001
```

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

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

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24467?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/24467?src=pr&el=footer). Last update [aa1549f...3dabccf](https://codecov.io/gh/pandas-dev/pandas/pull/24467?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/24467?src=pr&el=h1) Report
> Merging [#24467](https://codecov.io/gh/pandas-dev/pandas/pull/24467?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/c1af4f5ede3f6dfb1d1652c62afbcdc88b5eef91?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/24467/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/24467?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #24467      +/-   ##
==========================================
- Coverage   92.31%   92.31%   -0.01%     
==========================================
  Files         165      165              
  Lines       52252    52204      -48     
==========================================
- Hits        48237    48192      -45     
+ Misses       4015     4012       -3
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.73% <100%> (-0.01%)` | :arrow_down: |
| #single | `42.96% <0%> (+0.01%)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24467?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/24467/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `96.62% <100%> (ø)` | :arrow_up: |
| [pandas/core/arrays/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/24467/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3RpbWVkZWx0YXMucHk=) | `87.36% <0%> (-0.27%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24467/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `87.75% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/arrays/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/24467/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3BlcmlvZC5weQ==) | `98.42% <0%> (-0.05%)` | :arrow_down: |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/24467/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `97.53% <0%> (ø)` | :arrow_up: |
| [pandas/core/arrays/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/24467/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2Jhc2UucHk=) | `98.23% <0%> (+0.03%)` | :arrow_up: |
| [pandas/core/arrays/sparse.py](https://codecov.io/gh/pandas-dev/pandas/pull/24467/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3NwYXJzZS5weQ==) | `92.17% <0%> (+0.06%)` | :arrow_up: |
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/24467/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `98.39% <0%> (+0.13%)` | :arrow_up: |
| [pandas/core/arrays/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/24467/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lbGlrZS5weQ==) | `96.08% <0%> (+0.43%)` | :arrow_up: |

------

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

lgtm ping on green

### ***Better Example***
**Before`**
```python
In [11]: import pandas as pd
    ...: 
    ...: df1 = pd.DataFrame([[50., 60.,70.], [80., 90.,100.]], columns=['A', 'B','C'])
    ...: 
    ...: upper = pd.DataFrame([[50., 80.,49.], [100.,100.,90.]], columns=['B', 'C','A'])
    ...: 
    ...: lower = pd.DataFrame([[60., 40.,35.], [90.,95.,85.]], columns=['C', 'B','A'])
    ...: 
    ...: 

In [12]: df1
Out[12]: 
      A     B      C
0  50.0  60.0   70.0
1  80.0  90.0  100.0

In [16]: lower[df1.columns]
Out[16]: 
      A     B     C
0  35.0  40.0  60.0
1  85.0  95.0  90.0

In [17]: upper[df1.columns]
Out[17]: 
      A      B      C
0  49.0   50.0   80.0
1  90.0  100.0  100.0

In [18]: df1.clip(lower=lower,upper=upper)
Out[18]: 
      A     B      C
0  50.0  80.0   70.0
1  90.0  95.0  100.0

```

**After**
```python

In [8]: (df1.clip(lower=lower, upper=upper))
Out[8]:
      A     B      C
0  49.0  50.0   70.0
1  85.0  95.0  100.0
```
@jreback it's green now
thanks @cgangwar11