I've encountered a problem when using .loc and .iloc to assign values to a 1D slice of a Panel when the axis in the direction of the slice has a MulitIndex. Here is a simple example to demonstrate:

import pandas as pd
import numpy as np
pn = pd.Panel(np.zeros((3, 3, 3)))
pn.loc[0, :, 0] = [1, 2, 3]
pn.major_axis = pd.MultiIndex.from_tuples(zip([1, 2, 3], list('abc')))
pn.loc[0, :, 0] = [1, 2, 3]

Running this code gives an IndexError at the last line with the message 'tuple index out of range'. Note how the error is only raised after the major axis has been set with the MulitIndex. Using .iloc or .ix instead produces the same error. A similar procedure using either of the other two axes produces no error. Pandas version is 0.15.1

Comment From: jreback

hmm, this is a pretty tricky part of the code. Seems straightforward to fix though. Interested in doing a PR?

Comment From: eoincondron

Thanks, but I don't think I'm really the person for the job. I've only been programming for 6 months and having just spent an hour staring at the indexing module, I think it would take me days or weeks just to figure out how pandas works under the hood. I appreciate the offer though.

Comment From: jreback

@eoincondron no worries....will hopefully get to this at some point.

Comment From: eoincondron

@jreback Sure, thanks. The fact that it works on the other axes suggests that it's a very small bug. It wasn't difficult for me to work around either.

Comment From: jreback

closing as Panels are deprecated