We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2d576ee commit a72d886Copy full SHA for a72d886
pandas/core/index.py
@@ -1364,9 +1364,10 @@ def _get_level_number(self, level):
1364
raise Exception('Level %s not found' % str(level))
1365
elif level < 0:
1366
level += self.nlevels
1367
+ # Note: levels are zero-based
1368
elif level >= self.nlevels:
1369
raise ValueError('Index has only %d levels, not %d'
- % (self.nlevels, level))
1370
+ % (self.nlevels, level + 1))
1371
return level
1372
1373
_tuples = None
0 commit comments