Skip to content

Commit a7c2caa

Browse files
committed
BUG: removes warning when a column name may collide with a method
Closes pandas-dev#17268 and reverts work from pandas-dev#16951 which warns users when creating a column whose name matches one of the methods defined on ndframes (e.g. 'sum' or 'mean'). The warning was deemed to be too much of a hindrance to the common use case of generating dataframes of summary statistics.
1 parent 8351f86 commit a7c2caa

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

pandas/core/generic.py

-4
Original file line numberDiff line numberDiff line change
@@ -1905,10 +1905,6 @@ def _slice(self, slobj, axis=0, kind=None):
19051905
return result
19061906

19071907
def _set_item(self, key, value):
1908-
if isinstance(key, str) and callable(getattr(self, key, None)):
1909-
warnings.warn("Column name '{key}' collides with a built-in "
1910-
"method, which will cause unexpected attribute "
1911-
"behavior".format(key=key), stacklevel=3)
19121908
self._data.set(key, value)
19131909
self._clear_item_cache()
19141910

0 commit comments

Comments
 (0)