I want to use a boolean to select the columns with more than 4000 entries from a dataframe comb
which has over 1,000 columns. This expression gives me a Boolean (True/False) result:
criteria = comb.ix[:,'c_0327':].count()>4000
I want to use it to select only the True
columns to a new Dataframe.
The following just gives me "Unalignable boolean Series key provided":
comb.loc[criteria,]
I also tried:
comb.ix[:, comb.ix[:,'c_0327':].count()>4000]
Similar to this question answer dataframe boolean selection along columns instead of row
but that gives me the same error: "Unalignable boolean Series key provided"
comb.ix[:,'c_0327':].count()>4000
yields:
c_0327 False
c_0328 False
c_0329 False
c_0330 False
c_0331 False
c_0332 False
c_0333 False
c_0334 False
c_0335 False
c_0336 False
c_0337 True
c_0338 False
.....
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…