BUG: revert collision warning
State: closed

- [ ] closes #17268 
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Reverts work in #16951 that warns when creating a column whose name collides with a method.

Labels:
name: Error Reporting
description: Incorrect or improved errors from pandas

Comments:
Thanks a lot!

One related thing is that it would be nice if one actually gets a warning when you try to overwrite a built-in so not assigning a column like `df['mean']` which does not override the `.mean()` method, but with `df.mean = [...]`.

Example with master:

```
In [1]: df = pd.DataFrame({'test': [1, 2, 3, 4]})

In [2]: df
Out[2]: 
   test
0     1
1     2
2     3
3     4

In [3]: df.mean = [2, 3, 4, 5]

In [4]: df
Out[4]: 
   test
0     1
1     2
2     3
3     4

In [5]: df.mean()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-4bf1ee5cd33c> in <module>()
----> 1 df.mean()

TypeError: 'list' object is not callable
```

(but didn't look in detail, so not sure if this is actually possible / easy to do)

@deniederhut Can you also take a look at this comment on the warning message? https://github.com/pandas-dev/pandas/pull/16951#discussion_r131928076
Hi @jorisvandenbossche! I've updated the warning message to:

> Pandas doesn't allow columns to be created via a new attribute name - see https://pandas.pydata.org/pandas-docs/stable/indexing.html#attribute-access

I have mixed feelings about warning on `df.mean = [...]`. I think people might find it to be surprising, because the general pattern in Python is to permit overwriting of public methods. If this is something that the maintainers would really like to see, I can start looking into an implementation.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17298?src=pr&el=h1) Report
> Merging [#17298](https://codecov.io/gh/pandas-dev/pandas/pull/17298?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/58d872903449b8a29237288ade6227cdb280fe18?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #17298      +/-   ##
==========================================
- Coverage   91.03%   91.01%   -0.02%     
==========================================
  Files         162      162              
  Lines       49567    49565       -2     
==========================================
- Hits        45123    45112      -11     
- Misses       4444     4453       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.79% <ø> (-0.01%)` | :arrow_down: |
| #single | `40.24% <ø> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17298?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/17298?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `92.02% <ø> (-0.01%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17298?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17298?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.72% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17298?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/17298?src=pr&el=footer). Last update [58d8729...72a479d](https://codecov.io/gh/pandas-dev/pandas/pull/17298?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/17298?src=pr&el=h1) Report
> Merging [#17298](https://codecov.io/gh/pandas-dev/pandas/pull/17298?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/20fee85ede7f2052f855b8f3445cd1ffc17ee0c3?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17298      +/-   ##
==========================================
- Coverage   91.15%   91.14%   -0.02%     
==========================================
  Files         163      163              
  Lines       49591    49589       -2     
==========================================
- Hits        45207    45196      -11     
- Misses       4384     4393       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.92% <100%> (-0.01%)` | :arrow_down: |
| #single | `40.25% <0%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17298?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/17298?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `91.98% <100%> (-0.01%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17298?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17298?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.72% <0%> (-0.1%)` | :arrow_down: |

------

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

@jorisvandenbossche I've fixed the name that circle-ci was tripping on. Is this good to go?
@deniederhut can you rebase this just to make sure no changes; ping on green. lgtm.
thanks!
😄