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
1
vote
0 answers

Pipeline for UMAP Clustering

# Import pandas library import pandas as pd initialize list of lists data = {'person_id':[1,1,2,1,2,3,4,5,6,5,6,4,5,4,7,8,8,9,10,1,10,1,10,9,8,7,6,5,4,2], 'condition_concept_id':[43927,5234, 1111, 2222, 5234, 4444000, 67675, 43927, 67890, 5234,…
1
vote
1 answer

Group by MIN value in SQL Server pivot table query

I have looked through some similar questions but still can't figure this out. My query: SELECT * FROM (SELECT Sites.ID AS SiteID, MIN(DateInspectionDue) AS DateDue, ItemType, SiteItems.ID AS SiteItemID FROM…
Sparrowhawk
  • 358
  • 1
  • 4
  • 11
1
vote
1 answer

DAX Measure to reference Pivot Table Column. Return most recent row of table

I'm using Excel 265. I have a list of stock transactions imported via Power Query using an SQL-Server connection loaded to the data model. I want to create a Pivot table called 'PivotTable1' to return a unique list of 'ITEMID's. Then have the second…
Michael.C
  • 79
  • 10
1
vote
0 answers

Excel Pivot Table: Can't Create If Statement in Calculated Field

I have created a Pivot Table in Excel. Here are the fields: And here is how it looks: What I want to do now is create a calculated field called Stock Price. The goal of this field is to list the PRICE value IF the Type is 'Stock'. I.e., PRICE…
Moshe
  • 6,011
  • 16
  • 60
  • 112
1
vote
1 answer

Generating 2- and 3-way crosstabs in R

I am trying to generate some 2- and 3-way frequency tables. I believe there must be a more efficient way of adding frequencies. Here is a 2-way table example: # create 10 x 5 zero-cell table n_row = 10; n_col = 5 row_labs = paste('A',…
striatum
  • 1,428
  • 3
  • 14
  • 31
1
vote
1 answer

MS Project Pivot table created in older version of excel

I have a snippet of code that is run from MS project to extract data and then creates a pivot table in excel. This is working fine. When I tried to add a slicer to that pivot table, the icon appears to be greyed out. I googled over the internet and…
1
vote
1 answer

How to demonstrate your data analysis in python such as dashboard

I am doing a data analysis by using python. However, I still didn't find answer to this question. After completing the work how I can send it to colleagues or boss who are not using python. For example if I did the analysis in excel (pivots) they…
Adamcra
  • 13
  • 3
1
vote
1 answer

Adding subtotals to pivot_table using groupby

I'm trying to include subtotals in my pivot_table. Pivot table code # Specify the aggregation functions aggfunc = {'amt': 'sum', 'llp': 'first'} Pivot and calculate aggregated values using aggfunc Pivoted_data =…
user18233539
  • 129
  • 1
  • 2
  • 8
1
vote
0 answers

how can we make filestream from a ref variable of a syncfusion pivot table

Iam working on Visual Studio 2022,Syncfusion blazor c#.I have a pivotTable and pivotchart in a single razor page I wanted to export both in a single file. So for achieving that an we able to get filestream from ref variable of pivot table. Please…
1
vote
2 answers

Apply a jitter-like procedure to a crosstab in R

Is there a way to apply something similar to jitter() for a frequency table while keeping the Total constant? I would need to generate many tables that would be similar to each other. Imagine, for example, parallel forms of a test which would give a…
striatum
  • 1,428
  • 3
  • 14
  • 31
1
vote
2 answers

Pivot a DataFrame having dictionary as values in columns

I have a dataframe as shown below: Code Description Date Quantity dasd2132 dummy 1 2023-06 {'prev_value': 0.0, 'new_value': 90.0} 312dasda dummy 2 2023-07 0 das432cs dummy 3 2023-08 0 31231dsa dummy 4 2023-09 0 It can contain a…
1
vote
1 answer

How to aggregate subcategories in pandas.dataframe.pivot_table

I created a pivot table that is meant to count the total number of rejections for Types A-K and their subtypes (A1-A12) piv_table2 = df.loc[(Filter1) & (Filter2)].pivot_table( values=["Level3"], index=["Level1", "Level2"], …
1
vote
0 answers

Pivot non-timeseries table in grafana

I have a (postgresql) database table that is a list of views by date, page and user: date,page,user 2023-01-01,home,user1 2023-01-01,home,user2 2023-01-02,foo,user3 2023-01-02,bar,user1 I want to create a stacked bar chart that is the count of…
mkst
  • 565
  • 6
  • 16
1
vote
1 answer

Django Pivot QuerySet of multiple models from long to wide format

I wonder how to render a table using data from multiple models. In the database the data is stored in long format but it should be rendered in wide format. Using a data model like this: class Municipality(models.Model): mun_name =…
1
vote
2 answers

How to update Excel Pivot filters?

When I have updated information in a Pivot table I can click "Refresh" and it will update the data within the pivot chart. However, there seems to be a bug where it does not update the filter values in the pivot filter. Here is a brief video…
David542
  • 104,438
  • 178
  • 489
  • 842