We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
from stackoverflow
In [25]: cpaste Pasting code; enter '--' alone on the line to stop or use Ctrl-D. :>>> index = pd.MultiIndex.from_arrays([['a','a', 'b', 'b'], [1,2,1,2]], :... names=['first', 'second']) :>>> data = pd.DataFrame(np.random.rand(len(index)), index=index, columns=['A']) :>>> print data :-- A first second a 1 0.026915 2 0.777457 b 1 0.445726 2 0.243053 In [26]: selected = data.xs(2, level='second', copy=False) In [27]: selected Out[27]: A first a 0.777457 b 0.243053 In [28]: selected['A'][0] = 100 In [29]: selected Out[29]: A first a 100.000000 b 0.243053 In [30]: data Out[30]: A first second a 1 0.026915 2 0.777457 b 1 0.445726 2 0.243053
The text was updated successfully, but these errors were encountered:
It seems that xs(copy=False) does not work with MultiIndex.
Sorry, something went wrong.
This can't be fixed. Would an exception be preferable?
189d04c
No branches or pull requests
from stackoverflow
The text was updated successfully, but these errors were encountered: