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
9
votes
1 answer

Add Grand Total to Pivot Chart in Data Table but not in graph

So apparently Pivot Table, when converted into Pivot Chart, does not use the "Grand Total" line when asked to display the "Data Table" below the chart. Online and on Stackexchange, it has been suggested that one should create a separate table, which…
Amatya
  • 1,203
  • 6
  • 32
  • 52
9
votes
2 answers

Why does the Periods argument of Excel.Range.Group take an array?

Recently I was learning how to automate the creation of a pivot table in Excel with VBA, and the implementation of the Excel.Range.Group() method struck me as odd. The fourth parameter, Periods, takes a 7 element array of Boolean values to indicate…
Drew Chapin
  • 7,779
  • 5
  • 58
  • 84
9
votes
1 answer

python - create a pivot table

I'm trying to create a pivot table from a Numpy array in python. I've done a lot of research but I cannot find a straight forward solution. I know you can do it with Pandas but I'm having trouble installing it - but there must be a way of doing it…
user1893354
  • 5,778
  • 12
  • 46
  • 83
9
votes
1 answer

pivot table in mysql

I know how to make a pivot table in mysql (see code example below), but what if the number of columns in the pivot table is very large and I don't want to type 2000 or so tagnames? - Is there a way to have that list generated? Many thanks in…
user1316758
  • 391
  • 1
  • 6
  • 8
8
votes
6 answers

How to pivot tables in MySQL

I have a question about how to pivot the table in MySQL. I have a dataset, columns like this: ID Name job_title 1 Sam Fireman 2 Tomas Driver 3 Peter Fireman 4 Lisa Analyst 5 Marcus Postman 6 Stephan …
Xiaoxi Chen
  • 133
  • 1
  • 2
  • 8
8
votes
2 answers

calculated field in pivot table divide one column by the other EXCEL

I have two columns in a pivot table. Count of Work orders, and Sum of the Cost. I want to insert a calculated field that simply divides the sum of cost by count of work orders to get an average per work order. When I put I insert a calculated field…
George
  • 317
  • 2
  • 4
  • 16
8
votes
5 answers

Refresh PivotTable EPPlus

I am editing an existing spreadsheet in C# using EPPlus. I am altering the raw data on the second worksheet which is being used as the data source for a Pivot table on the first worksheet. My edits all work perfectly, the problem I am having is that…
connectedsoftware
  • 6,987
  • 3
  • 28
  • 43
8
votes
1 answer

pandas pivot_table with dates as values

let's say I have the following table of customer data df = pd.DataFrame.from_dict({"Customer":[0,0,1], "Date":['01.01.2016', '01.02.2016', '01.01.2016'], "Type":["First Buy", "Second Buy", "First Buy"], …
Quickbeam2k1
  • 5,287
  • 2
  • 26
  • 42
8
votes
3 answers

pandas pivot_table keep index

i have a dataframe : import pandas as pd data = {'day_bucket': ['2011-01-21', '2011-01-22', '2011-01-23', '2011-01-24'], 'label': ['birds', 'birds', 'birds', 'birds'], 'numeric_value': [4, 0, 7, 3]} df = pd.DataFrame(data) day_bucket label …
Vincent Claes
  • 3,960
  • 3
  • 44
  • 62
8
votes
2 answers

pivot irregular dictionary of lists into pandas dataframe

(Or a list of lists... I just edited) Is there an existing python/pandas method for converting a structure like this food2 = {} food2["apple"] = ["fruit", "round"] food2["bananna"] = ["fruit", "yellow", "long"] food2["carrot"] = ["veg",…
Mark Miller
  • 3,011
  • 1
  • 14
  • 34
8
votes
3 answers

download rpivotTable output in shiny

I've found an interesting package rpivotTable. I'd like to create shiny app which includes rpivotTable with the possibility to download generated data using downloadHandler. However, I am unable to find the solution, how to create data.frame or…
AK47
  • 1,318
  • 4
  • 17
  • 30
8
votes
3 answers

ValueError: Index contains duplicate entries, cannot reshape

I'm trying to reshape my pd dataframe with the following function: ar = ar.pivot(index='Received', columns='Merch Ref', values='acceptance_rate') The dataset looks like: Merch Ref Received acceptance_rate 0 SF 2014-08-28…
Blue Moon
  • 4,421
  • 20
  • 52
  • 91
8
votes
2 answers

Share PivotCache for PivotTables built with data model

I am just cleaning up my workbook and I have used the following code to consolidate my PivotCaches (I had around 200 prior to the cleaning). Sub changeCache() Dim ws As Worksheet Dim pt As PivotTable Dim pc As PivotCache Dim first As Boolean On…
Chris
  • 737
  • 3
  • 16
  • 32
8
votes
1 answer

XSSF (POI) - Adding "formula" column to pivot table

I am using POI 3.12-beta1: org.apache.poi poi 3.12-beta1 org.apache.poi
anonymous
  • 657
  • 1
  • 8
  • 21
8
votes
2 answers

R sort summarise ddply by group sum

I have a data.frame like this x <- data.frame(Category=factor(c("One", "One", "Four", "Two","Two", "Three", "Two", "Four","Three")), City=factor(c("D","A","B","B","A","D","A","C","C")), Frequency=c(10,1,5,2,14,8,20,3,5)) Category City Frequency 1…
Liliana Pacheco
  • 881
  • 10
  • 13