Skip to content

Commit

Permalink
Add variable 'level_param' to mimic pandas exception exactly
Browse files Browse the repository at this point in the history
  • Loading branch information
itholic committed Oct 2, 2019
1 parent 7cd8889 commit 91160ea
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion databricks/koalas/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,7 @@ def drop(self,
if not isinstance(index, (str, tuple, list)):
raise ValueError("'index' type should be one of str, list, tuple")
if level is None:
level_param = False
level = 0
if level >= len(self._internal.index_scols):
raise ValueError("'level' should be less than the number of indexes")
Expand All @@ -1594,7 +1595,7 @@ def drop(self,
index_scols = [self._internal.index_scols[lvl] == idx
for lvl, idx in enumerate(idxes, level)]
except IndexError:
if level == 0:
if not level_param:
raise KeyError("Key length ({}) exceeds index depth ({})"
.format(len(self._internal.index_scols), len(idxes)))
else:
Expand Down

0 comments on commit 91160ea

Please sign in to comment.