Template request | Bug report | Generate Data Product
Tags: #python #dataset #pivottable #dataexploration
Author: Florent Ravenel
Description: This notebook allows you to interactively explore and analyze a dataset using a pivot table. It uses the pivottablejs
library to generate a dynamic pivot table in your web browser, giving you the ability to sort, filter, and aggregate data in real-time. This template provides a simple and intuitive way to explore and gain insights from your dataset, making it a valuable tool for data analysis and visualization.
References:
- https://github.com/nicolaskruchten/jupyter_pivottablejs
- https://github.com/nicolaskruchten/pivottable
import pandas as pd
try:
from pivottablejs import pivot_ui
except:
!pip install pivottablejs --user
from pivottablejs import pivot_ui
# Create a fake dataset
data = {
"Month": [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
]
* 2,
"Region": ["North"] * 12 + ["South"] * 12,
"Sales": [
11000,
12000,
13000,
14000,
15000,
16000,
17000,
18000,
19000,
20000,
21000,
22000,
]
+ [
10000,
11000,
12000,
13000,
14000,
15000,
16000,
17000,
18000,
19000,
20000,
21000,
],
}
df = pd.DataFrame(data)
df.head(12)
# Use the pivot_ui function to create a pivot table
pivot_ui(df)