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

  • SEARCH
  • Home
  • 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 7808179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:04:19+00:00 2026-06-02T03:04:19+00:00

I have aggregated data using pandas data frame. Below is some actual data shown

  • 0

I have aggregated data using pandas data frame. Below is some actual data shown and how I aggregated it.

fdf.groupby(['row',col'])['percent'].sum()

http://pastebin.com/R8XWpgtU

What I would like to do is create a 2d numpy array of this (rows = row, columns = col). Any slick way to do this ?

Another way I did something similar was create a pivot table

pivot_table(fdf,values='percent',rows='row',cols='col', aggfunc=np.sum)

In this case I want to convert this pivot table to 2d numpy array. Is there a way for me to index into each cell of this table. If so then I probably will be Ok with the table itself.

  • 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-02T03:04:20+00:00Added an answer on June 2, 2026 at 3:04 am

    Try:

    result = fdf.groupby(['row',col'])['percent'].sum()
    result.unstack('col').values
    

    Alternately:

    fdf.pivot_table('percent', rows='row', cols='col', aggfunc='sum').values
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a report in SSRS 2008 that shows data aggregated from four levels
Using the guidelines here I have successfully queried a simple fusion table for some
I am using a composite pattern as shown in the class diagram below. Basically
I have some data id ref == ========== 1 3536757616 1 3536757617 1 3536757618
I have a database and I need to present a data via HTTP using
I'm using reshape in R to compute aggregate statistics over columns of a data.frame.
I have an user defined table function in SQL Server that aggregate data from
I have the following data structure (it's an append only table for mapping content
Every example of using PIVOT in MSSQL shows people using this to aggregate data.
I have a query that sums and aggregates alot of data something like this:

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.