You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If sortlevel is called with an out-of-range level, the error message is a bit confusing, particularly if the level is equal to the maximum number of levels.
# Example from "Python for Data Analysys", page 148
import pandas as pd
import numpy as np
frame = pd.DataFrame(np.arange(12).reshape((4,3)),
index=[list('aabb'), [1, 2, 1, 2]],
columns=[['Ohio','Ohio','Colorado'],['Green','Red','Green']])
frame.sortlevel(2)
.
.
.
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages/pandas/core/index.pyc in _get_level_number(self, level)
1363 elif level >= self.nlevels:
1364 raise ValueError('Index has only %d levels, not %d'
-> 1365 % (self.nlevels, level))
1366 return level
1367
ValueError: Index has only 2 levels, not 2
The text was updated successfully, but these errors were encountered:
* commit 'v0.9.1rc1-27-ge374f0f': (52 commits)
BUG: axes.color_cycle from mpl rcParams should not be joined as single string
BUG: icol duplicate columns with integer sequence failure. closepandas-dev#2228
TST: unit test for pandas-dev#2214
BUG: coerce ndarray dtype to object when comparing series
ENH: make vbench_suite/run_suite executable
ENH: Use __file__ to determine REPO_PATH in vb_suite/suite.py
BUG: 1 ** NA issue in computing new fill value in SparseSeries. closepandas-dev#2220
BUG: make inplace semantics of DataFrame.where consistent. pandas-dev#2230
BUG: fix internal error in constructing DataFrame.values with duplicate column names. closepandas-dev#2236
added back mask method that does condition inversion added condition testing to where that raised ValueError on an invalid condition (e.g. not an ndarray like object) added tests for same
in core/frame.py
TST: getting column from and applying op to a df should commute
TST: add dual ( x op y <-> y op x ) tests for arith operators
BUG: Incorrect error message due to zero based levels. closepandas-dev#2226
fixed file modes for core/frame.py, test/test_frame.py
relaxed __setitem__ restriction on boolean indexing a frame on an equal sized frame
in core/frame.py
ENH: warn user when invoking to_dict() on df with non-unique columns
BUG: modify df.iteritems to support duplicate column labels pandas-dev#2219
TST: df.iteritems() should yield Series even with non-unique column labels
...
If sortlevel is called with an out-of-range level, the error message is a bit confusing, particularly if the level is equal to the maximum number of levels.
The text was updated successfully, but these errors were encountered: