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 8476719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:15:28+00:00 2026-06-10T18:15:28+00:00

I have a dataframe that holds data at a particular level of aggregation –

  • 0

I have a dataframe that holds data at a particular level of aggregation – let’s call it regional.

I also have a dict that explains how these regions are formed. Something like this:

map = {'Alabama': 'region_1', 'Arizona': 'region_1', 'Arkansas': 'region_2' ... }

And a set of weights for each state within its region, stored as a series:

Alabama    .25
Arizona    .75
Arkansas   .33
....

Is there an efficient way to apply this disaggregation map to get a new dataframe at a State level?

Aggregation is easy:

df_regional = df_states.groupby(map).sum()

But how can I do disaggregation?

  • 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-10T18:15:29+00:00Added an answer on June 10, 2026 at 6:15 pm

    Assuming two dataframes, df_states and df_regional, with the following
    structure:

    In [36]: df_states
    Out[36]: 
              Weight    Region
    Alabama     0.25  region_1
    Arizona     0.75  region_1
    Arkansas    0.33  region_2
    
    In [37]: df_regional
    Out[37]: 
              Value
    region_1    100
    region_2     80
    

    Does pandas.merge arrange the data in a way that seems useful?

    In [39]: df = pandas.merge(df_states, df_regional, left_on='Region', right_index=True)
    
    In [40]: df
    Out[40]: 
              Weight    Region  Value
    Alabama     0.25  region_1    100
    Arizona     0.75  region_1    100
    Arkansas    0.33  region_2     80
    
    In [41]: df.Weight * df.Value
    Out[41]: 
    Alabama     25.0
    Arizona     75.0
    Arkansas    26.4
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a dataframe source <- data.frame(ID=c(1,2), COUNT=c(3,4)) that looks like this: ID
I have two data.frames that I want to append together. One data.frame holds past
I have dataframe that contains 70-80 rows of ordered response time (rt) data for
I have a dataframe that looks like this: data median min max no_of_threads 2.33
I have a dataframe that looks like this: person n start end 1 sam
I have a dataframe with a column of integers that I would like to
I have a dataframe with one column that I would like to split into
I have a dataframe and I would like to apply a function that takes
I have a data frame that is some 35,000 rows, by 7 columns. it
I have a data frame that's about ts1[100, 2000] in dimension as follows: >

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.