Skip to content

Commit bcc2220

Browse files
committed
Better error message on access to non-existing attribute
1 parent 1fd6ed9 commit bcc2220

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

python/pyspark/sql/dataframe.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,8 @@ def __getattr__(self, name):
633633
[Row(age=2), Row(age=5)]
634634
"""
635635
if name not in self.columns:
636-
raise AttributeError("No such column: %s" % name)
636+
raise AttributeError(
637+
"'%s' object has no attribute '%s'" % (self.__class__.__name__, name))
637638
jc = self._jdf.apply(name)
638639
return Column(jc)
639640

0 commit comments

Comments
 (0)