Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[X] I have confirmed this bug exists on the master branch of pandas.
Reproducible Example
import pandas as pd
import numpy as np
mi = pd.MultiIndex.from_tuples([(('a1','a2'),('b1','b2')), (('a1','a2'),('c1','c2'))])
df = pd.DataFrame(data=np.arange(2).reshape(1,2), columns=mi)
# This line works
df[(('a1','a2'),('b1','b2'))]
# This line would throw exception
df[[(('a1','a2'),('b1','b2'))]]
Issue Description
When a data frame has columns of MultiIndex, and each level is a tuple. Selecting columns with array of column labels would raise ValueError.
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[X] I have confirmed this bug exists on the master branch of pandas.
Reproducible Example
Issue Description
When a data frame has columns of MultiIndex, and each level is a tuple. Selecting columns with array of column labels would raise
ValueError
.But selecting with a single label works.
Expected Behavior
Return columns with no error.
Installed Versions