Skip to content

Commit bc8cbe7

Browse files
committed
pandas-dev#7211 @dsm2173 @jmp392 updated KeyError text to be more informative in this particular common error type
1 parent 2eef865 commit bc8cbe7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas/_libs/hashtable_class_helper.pxi.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ cdef class PyObjectHashTable(HashTable):
856856
if k != self.table.n_buckets:
857857
return self.table.vals[k]
858858
else:
859-
raise KeyError(val)
859+
raise KeyError("Column with name \"{}\" is not found. Did you mean \"df[{}:]\" ?".format(val,val))
860860

861861
cpdef set_item(self, object key, Py_ssize_t val):
862862
cdef:

0 commit comments

Comments
 (0)