Skip to content

Commit 7a92b7f

Browse files
committed
FIX: replaces ndim check with ABC subclass check
1 parent b3ee1ff commit 7a92b7f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/core/generic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
is_re_compilable,
2727
pandas_dtype)
2828
from pandas.core.dtypes.cast import maybe_promote, maybe_upcast_putmask
29-
from pandas.core.dtypes.missing import isna, notna
30-
from pandas.core.dtypes.generic import ABCSeries, ABCPanel
29+
from pandas.core.dtypes.missing import isnull, notnull
30+
from pandas.core.dtypes.generic import ABCSeries, ABCPanel, ABCDataFrame
3131

3232
from pandas.core.common import (_values_from_object,
3333
_maybe_box_datetimelike,
@@ -3360,7 +3360,7 @@ def __setattr__(self, name, value):
33603360
else:
33613361
object.__setattr__(self, name, value)
33623362
except (AttributeError, TypeError):
3363-
if (self.ndim > 1) and (is_list_like(value)):
3363+
if isinstance(self, ABCDataFrame) and (is_list_like(value)):
33643364
warnings.warn("Pandas doesn't allow Series to be assigned "
33653365
"into nonexistent columns - see "
33663366
"https://pandas.pydata.org/pandas-docs/"

0 commit comments

Comments
 (0)