Questions tagged [pivot-table]

A "pivot table" is a method of summarizing data in tabular form. Typically, these have a category column in the left hand side, and multiple summary columns to the right. Each different category will have its own row. Be sure to include the relevant language tag (python, excel, R, postgreSQL etc.) on your question.

A "pivot table" is a method of summarizing data in tabular form. Typically, these have a category column in the left hand side, and multiple summary columns to the right. Each different category will have its own row.

Pivot tables are typically found in data visualization programs, including spreadsheets and business intelligence. Note that a "pivot table" is also known as a "cross tab" or "cross tabulation".

Resources:

8105 questions
8
votes
1 answer

Change column names in Python Pandas from datetime objects to strings?

Following this recipe. I 'pivoted' a dataframe that looks like this: Close 2015-02-20 14:00:00 1200.1 2015-02-20 14:10:00 1199.8 2015-02-21 14:00:00 1199.3 2015-02-21 14:10:00 1199.0 2015-02-22 14:00:00 1198.4 2015-02-22…
hernanavella
  • 5,462
  • 8
  • 47
  • 84
8
votes
2 answers

Display continuous dates in Pivot Chart

I have a set of data in a pivot table with date times and events. I've made a pivot chart with this data, and grouped the data by day and year, then display a count of events for each day. So, my horizontal axis goes from 19 March 2007 to 11 May…
Douglas
  • 36,802
  • 9
  • 76
  • 89
8
votes
1 answer

simple pivot table of pandas dataframe

I'm trying to do a seemingly very simple task. Given a dataframe: daf = pd.DataFrame({'co':['g','r','b','r','g','r','b','g'], 'sh':['c','s','r','r','r','s','c','r']}) co sh 0 g c 1 r s 2 b r 3 r r 4 g r 5 r s 6 b…
David Makovoz
  • 1,766
  • 2
  • 16
  • 27
8
votes
7 answers

How can I paginate an array of objects in Laravel?

I'm building an application using Laravel 4.2. I have a model for units and another for users and pivot table user_units. Every user in this application can select a unit and add it to his favorite list then he can publish this unit with his…
Maged Hamid
  • 952
  • 1
  • 9
  • 18
8
votes
5 answers

Updating data source on multiple pivot tables within Excel

Is there an easy way to update the data source for multiple pivot tables on a single Excel sheet at the same time? All of the pivot tables reference the same named range, but I need to create a second worksheet that has the same pivot tables, but…
phrenetic
  • 329
  • 3
  • 4
  • 11
8
votes
1 answer

Weighted average using pivot tables in pandas

I have written some code to compute a weighted average using pivot tables in pandas. However, I am not sure how to add the actual column which performs the weighted averaging (Add a new column where each row contains value of 'cumulative'/'COUNT').…
user308827
  • 21,227
  • 87
  • 254
  • 417
8
votes
2 answers

hierarchical faceting with Elasticsearch

I'm using elasticsearch and need to implement facet search for hierarchical object as follow: category 1 (10) subcategory 1 (4) subcategory 2 (6) category 2 (X) ... So I need to get facets for two related objects. Documentation says that…
8
votes
2 answers

Pandas: Pivoting with multi-index data

I have two dataframes which looks like this: rating BMW Fiat Toyota 0 7 2 3 1 8 1 8 2 9 10 7 3 8 3 9 own BMW Fiat Toyota 0 1 1 0 1 0 1 1 2 0 0 1 3 …
Brendon McLean
  • 416
  • 5
  • 10
8
votes
3 answers

Different value counts on same column

I am new to Oracle. I have an Oracle table with three columns: serialno, item_category and item_status. In the third column the rows have values of serviceable, under_repair or condemned. I want to run the query using count to show how many are…
raja
  • 189
  • 2
  • 2
  • 12
8
votes
1 answer

Mysql query to dynamically convert rows to columns on the basis of two columns

I have followed a question here to use a Mysql query to dynamically convert rows to columns. This works fine, but i need to convert this on basis of two columns, The query mentioned in above link works for a single column "data", but i want to work…
Moon
  • 19,518
  • 56
  • 138
  • 200
8
votes
1 answer

Alternatives to OLAP SSAS Cube Pivot Tables in Excel

I am accessing OLAP SSAS Cubes on a 2005 SQL Server using Excel 2007 pivot tables and finding that refreshing some of the tables is taking >10 minutes. My coworkers seem to think it is a sad reality, but I am wondering if there are alternatives I…
asjohnson
  • 1,057
  • 4
  • 17
  • 25
8
votes
2 answers

Filtering and selecting from pivot tables made with python pandas

I'm struggling with hierarchical indexes in the Python pandas package. Specifically I don't understand how to filter and compare data in rows after it has been pivoted. Here is the example table from the documentation: import pandas as…
alexhli
  • 399
  • 2
  • 6
  • 20
7
votes
1 answer

Excel sheet prompting for SQl Login Credentials

I Have an Excel Sheet where i had created an pivot table which is taking data from Sql Table.I am downloading that Excel sheet from an Application to Client machine and when we try to open it in clint machine, it is asking for the SQl Server Login…
Dharmendra
  • 217
  • 2
  • 4
  • 14
7
votes
5 answers

Speed up pivot table filtering VBA code

I have a pivot table with a pivot field and contain many items. I've VBA code logic to decide if the pivot value should be visible or not. The problem is excel recalculates pivot table for each field shown or hidden which makes it very slow. I would…
Ankit
  • 653
  • 2
  • 8
  • 18
7
votes
2 answers

Pivoting in Linq

I am using LINQ-to-Entities, and would like to perform a pivot. For exampe, I have this table: | data1 | data2 | +-------+-------+ | 1 | A | | 1 | B | | 2 | P | | 2 | Q | | 2 | R | +---------------+ And I…
jwd
  • 10,837
  • 3
  • 43
  • 67