Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8909145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:21:34+00:00 2026-06-15T03:21:34+00:00

When creating a DataFrame with MultiIndex columns it seems not possible to select /

  • 0

When creating a DataFrame with MultiIndex columns it seems not possible to select / filter rows using syntax like df[df["AA"]>0.0].
For example:

import pandas as pd
import numpy as np

dates = np.asarray(pd.date_range('1/1/2000', periods=8))
_metaInfo = pd.MultiIndex.from_tuples([('AA', '[m]'), ('BB', '[m]'), ('CC', '[s]'), ('DD', '[s]')], names=['parameter','unit'])

df = pd.DataFrame(randn(8, 4), index=dates, columns=_metaInfo)
print df[df['AA']>0.0]

The result of df[“AA”]>0.0 is an indexed DataFrame iso a Timeseries. This probably causes the crash.

When using the same metaInfo as an index for the rows, the situation is different:

df1 = pandas.DataFrame(np.random.randn(4, 6), index=_metaInfo)
print df1[df1["AA"]>0.0]

produces:

[ 1.13268106 -0.06887761  0.68535054  2.49431163 -0.29349413  0.34772553]

which are the elements of row AA larger than zero. This gives only the values of row AA and not of the other columns of the DataFrame.

Is there a workaround? Am I trying to do something I shouldn’t?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:21:35+00:00Added an answer on June 15, 2026 at 3:21 am

    You can select only the ‘AA’ column and use it as a filter on the entire df.

    Like:

    df[df[('AA','[m]')]>0.0]
    
    parameter         AA        BB        CC        DD
    unit             [m]       [m]       [s]       [s]
    2000-01-01  0.600748 -1.163793 -0.982248 -0.397988
    2000-01-03  1.045428  0.365353  0.049152  1.902942
    2000-01-06  0.891202  0.021921  1.215515 -1.624741
    2000-01-08  0.999217 -1.110213  0.257718 -0.096018
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I creating a web application using JSF,Hibernate,Spring. I have added a filter for checking
Creating MVC3 Razor Helper like Helper.BeginForm() says that it can be done using extension
I am creating a survey. There are 31 possible questions, I would like each
According to Creating an R dataframe row-by-row , it's not ideal to append to
Creating a website using simple html(not html5) and css but got stock in mouseover
Creating a simple RPG game, first time using XNA. Trying to get my character
Creating the closure is easy but using it is confusing for me. Here is
Creating a browser based single-page browser based RIA. Would like to make use of
Creating a rating system and the info is not being transmitted through my $_GET
Creating a C# install package and I'd like on completed install for the Program

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.