Skip to content

Commit d805001

Browse files
committed
DOC: removes references to warn on collision
1 parent 1f2a13e commit d805001

File tree

2 files changed

+3
-36
lines changed

2 files changed

+3
-36
lines changed

doc/source/indexing.rst

-15
Original file line numberDiff line numberDiff line change
@@ -279,21 +279,6 @@ new column. In 0.21.0 and later, this will raise a ``UserWarning``:
279279
1 2.0
280280
2 3.0
281281
282-
Similarly, it is possible to create a column with a name which collides with one of Pandas's
283-
built-in methods or attributes, which can cause confusion later when attempting to access
284-
that column as an attribute. This behavior now warns:
285-
286-
.. code-block:: ipython
287-
288-
In[4]: df['sum'] = [5., 7., 9.]
289-
UserWarning: Column name 'sum' collides with a built-in method, which will cause unexpected attribute behavior
290-
In[5]: df.sum
291-
Out[5]:
292-
<bound method DataFrame.sum of one sum
293-
0 1.0 5.0
294-
1 2.0 7.0
295-
2 3.0 9.0>
296-
297282
Slicing ranges
298283
--------------
299284

doc/source/whatsnew/v0.21.0.txt

+3-21
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ Improved warnings when attempting to create columns
6767
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6868

6969
New users are often flummoxed by the relationship between column operations and attribute
70-
access on ``DataFrame`` instances (:issue:`5904` & :issue:`7175`). Two specific instances
71-
of this confusion include attempting to create a new column by setting into an attribute:
70+
access on ``DataFrame`` instances (:issue:`7175`). One specific instance
71+
of this confusion is attempting to create a new column by setting into an attribute:
7272

7373
.. code-block:: ipython
7474

@@ -86,25 +86,7 @@ This does not raise any obvious exceptions, but also does not create a new colum
8686
1 2.0
8787
2 3.0
8888

89-
The second source of confusion is creating a column whose name collides with a method or
90-
attribute already in the instance namespace:
91-
92-
.. code-block:: ipython
93-
94-
In[4]: df['sum'] = [5., 7., 9.]
95-
96-
This does not permit that column to be accessed as an attribute:
97-
98-
.. code-block:: ipython
99-
100-
In[5]: df.sum
101-
Out[5]:
102-
<bound method DataFrame.sum of one sum
103-
0 1.0 5.0
104-
1 2.0 7.0
105-
2 3.0 9.0>
106-
107-
Both of these now raise a ``UserWarning`` about the potential for unexpected behavior. See :ref:`Attribute Access <indexing.attribute_access>`.
89+
Setting a list-like data structure into a new attribute now raise a ``UserWarning`` about the potential for unexpected behavior. See :ref:`Attribute Access <indexing.attribute_access>`.
10890

10991
.. _whatsnew_0210.enhancements.other:
11092

0 commit comments

Comments
 (0)