Name | streamlit-pivottable JSON |
Version |
0.2.1
JSON |
| download |
home_page | None |
Summary | This Project is created at 2025 Jan 6th |
upload_time | 2025-01-23 16:18:14 |
maintainer | None |
docs_url | None |
author | TAN YI HAO |
requires_python | >=3.7 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Streamlit Pivot Table
This Project is created at 2025 Jan 6th
```sh
import streamlit as st
from streamlit_pivottable import streamlit_pivottable
import pandas as pd
import numpy as np
# Set page configuration
st.set_page_config(layout='wide')
# Limit the number of rows
num_rows = 1000000
# Generate sample DataFrame for Pivot Table
df = pd.DataFrame({
"Category": np.random.choice(
["Category A", "Category B", "Category C", "Category D",
"Category E", "Category F", "Category G", "Category H",
"Category I", "Category J"], size=num_rows),
"Region": np.random.choice(
["North", "South", "East", "West", "Central", "Northeast",
"Southeast", "Northwest", "Southwest", "International"], size=num_rows),
"Priority": np.random.choice(
["Very Low", "Low", "Medium Low", "Medium", "Medium High",
"High", "Very High", "Critical", "Non-Critical", "Undefined"], size=num_rows),
"Product Type": np.random.choice(
["Product A", "Product B", "Product C", "Product D", "Product E",
"Product F", "Product G", "Product H", "Product I", "Product J"], size=num_rows),
"Quarter": np.random.choice(
["Q1", "Q2", "Q3", "Q4", "Q5", "Q6", "Q7", "Q8", "Q9", "Q10"], size=num_rows),
"Source": np.random.choice(
["Online", "Offline", "In-Store", "Marketplace", "Subscription",
"Direct Sales", "Wholesale", "Retail", "Auction", "Flash Sale"], size=num_rows),
"Gender": np.random.choice(
["Male", "Female", "Other", "Prefer Not to Say", "Non-Binary",
"Transgender", "Intersex", "Androgynous", "Genderqueer", "Agender"], size=num_rows),
"Age Range": np.random.choice(
["18-24", "25-34", "35-44", "45-54", "55-64", "65-74",
"75-84", "85-94", "95+", "Under 18"], size=num_rows),
"Customer Type": np.random.choice(
["New Customer", "Returning Customer", "VIP", "Wholesale Buyer",
"Gift Buyer", "Seasonal Buyer", "Frequent Shopper", "Rare Shopper",
"Business Client", "Occasional Buyer"], size=num_rows),
"Promotion": np.random.choice(
["Discounted", "Full Price", "Clearance", "Premium", "Subscription Plan",
"Limited Offer", "Flash Sale", "Bundle Deal", "Gift Pack", "Exclusive"], size=num_rows),
})
df["Value"] = np.random.uniform(1000000, 999999999, size=num_rows).round(2)
sample_size = 50000 # Adjust this to improve performance
df_sample = df.sample(n=sample_size, random_state=42)
data_2d = [df_sample.columns.tolist()] + df_sample.values.tolist()
default_settings = {
"rows":[],
"cols":[],
"aggregatorName":"Count",
"vals":[],
"rendererName":"Table",
"rowOrder":"",
"colOrder":"",
"valueFilter":{},
"hiddenAttributes":[],
"hiddenFromAggregators":[],
"hiddenFromDragDrop":[],
"menuLimit":500,
"unusedOrientationCutoff":85
}
# Display Streamlit component Pivot Table
with st.spinner("Loading Pivot Table..."):
with st.container():
pivot_table_settings = streamlit_pivottable(
data=data_2d,
default_settings=default_settings,
height=40,
use_container_width=True,
)
# Display pivot table configuration
if pivot_table_settings:
st.write("Pivot Table Configuration:")
st.json(pivot_table_settings)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "streamlit-pivottable",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "TAN YI HAO",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/9e/69/4c72f2f888d6553b2a5f0d33e0877c5d0c14ad23c0151c04ae21b1a9a4c3/streamlit_pivottable-0.2.1.tar.gz",
"platform": null,
"description": "# Streamlit Pivot Table\r\n\r\nThis Project is created at 2025 Jan 6th\r\n\r\n```sh\r\nimport streamlit as st\r\nfrom streamlit_pivottable import streamlit_pivottable\r\nimport pandas as pd\r\nimport numpy as np\r\n\r\n# Set page configuration\r\nst.set_page_config(layout='wide')\r\n\r\n# Limit the number of rows\r\nnum_rows = 1000000\r\n\r\n# Generate sample DataFrame for Pivot Table\r\ndf = pd.DataFrame({\r\n \"Category\": np.random.choice(\r\n [\"Category A\", \"Category B\", \"Category C\", \"Category D\",\r\n \"Category E\", \"Category F\", \"Category G\", \"Category H\",\r\n \"Category I\", \"Category J\"], size=num_rows),\r\n \"Region\": np.random.choice(\r\n [\"North\", \"South\", \"East\", \"West\", \"Central\", \"Northeast\",\r\n \"Southeast\", \"Northwest\", \"Southwest\", \"International\"], size=num_rows),\r\n \"Priority\": np.random.choice(\r\n [\"Very Low\", \"Low\", \"Medium Low\", \"Medium\", \"Medium High\",\r\n \"High\", \"Very High\", \"Critical\", \"Non-Critical\", \"Undefined\"], size=num_rows),\r\n \"Product Type\": np.random.choice(\r\n [\"Product A\", \"Product B\", \"Product C\", \"Product D\", \"Product E\",\r\n \"Product F\", \"Product G\", \"Product H\", \"Product I\", \"Product J\"], size=num_rows),\r\n \"Quarter\": np.random.choice(\r\n [\"Q1\", \"Q2\", \"Q3\", \"Q4\", \"Q5\", \"Q6\", \"Q7\", \"Q8\", \"Q9\", \"Q10\"], size=num_rows),\r\n \"Source\": np.random.choice(\r\n [\"Online\", \"Offline\", \"In-Store\", \"Marketplace\", \"Subscription\",\r\n \"Direct Sales\", \"Wholesale\", \"Retail\", \"Auction\", \"Flash Sale\"], size=num_rows),\r\n \"Gender\": np.random.choice(\r\n [\"Male\", \"Female\", \"Other\", \"Prefer Not to Say\", \"Non-Binary\",\r\n \"Transgender\", \"Intersex\", \"Androgynous\", \"Genderqueer\", \"Agender\"], size=num_rows),\r\n \"Age Range\": np.random.choice(\r\n [\"18-24\", \"25-34\", \"35-44\", \"45-54\", \"55-64\", \"65-74\",\r\n \"75-84\", \"85-94\", \"95+\", \"Under 18\"], size=num_rows),\r\n \"Customer Type\": np.random.choice(\r\n [\"New Customer\", \"Returning Customer\", \"VIP\", \"Wholesale Buyer\",\r\n \"Gift Buyer\", \"Seasonal Buyer\", \"Frequent Shopper\", \"Rare Shopper\",\r\n \"Business Client\", \"Occasional Buyer\"], size=num_rows),\r\n \"Promotion\": np.random.choice(\r\n [\"Discounted\", \"Full Price\", \"Clearance\", \"Premium\", \"Subscription Plan\",\r\n \"Limited Offer\", \"Flash Sale\", \"Bundle Deal\", \"Gift Pack\", \"Exclusive\"], size=num_rows),\r\n})\r\n\r\ndf[\"Value\"] = np.random.uniform(1000000, 999999999, size=num_rows).round(2)\r\n\r\n\r\nsample_size = 50000 # Adjust this to improve performance\r\ndf_sample = df.sample(n=sample_size, random_state=42)\r\ndata_2d = [df_sample.columns.tolist()] + df_sample.values.tolist()\r\n\r\n\r\ndefault_settings = {\r\n \"rows\":[],\r\n \"cols\":[],\r\n \"aggregatorName\":\"Count\",\r\n \"vals\":[],\r\n \"rendererName\":\"Table\",\r\n \"rowOrder\":\"\",\r\n \"colOrder\":\"\",\r\n \"valueFilter\":{},\r\n \"hiddenAttributes\":[],\r\n \"hiddenFromAggregators\":[],\r\n \"hiddenFromDragDrop\":[],\r\n \"menuLimit\":500,\r\n \"unusedOrientationCutoff\":85\r\n}\r\n\r\n# Display Streamlit component Pivot Table\r\nwith st.spinner(\"Loading Pivot Table...\"):\r\n with st.container():\r\n pivot_table_settings = streamlit_pivottable(\r\n data=data_2d,\r\n default_settings=default_settings,\r\n height=40,\r\n use_container_width=True,\r\n )\r\n\r\n# Display pivot table configuration\r\nif pivot_table_settings:\r\n st.write(\"Pivot Table Configuration:\")\r\n st.json(pivot_table_settings)\r\n\r\n\r\n```\r\n",
"bugtrack_url": null,
"license": null,
"summary": "This Project is created at 2025 Jan 6th",
"version": "0.2.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1eb22ae548c1f56cc282820ccc382c9dfebaf5f84b1e7524e08c7fd1c9ef8867",
"md5": "611c033f2b7db1a80ff5d4b2624046ae",
"sha256": "4e27d0abf93ccaf5720945925f9835b038e274a59c5d39ba6586e57f0447e3dc"
},
"downloads": -1,
"filename": "streamlit_pivottable-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "611c033f2b7db1a80ff5d4b2624046ae",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 13789836,
"upload_time": "2025-01-23T16:17:59",
"upload_time_iso_8601": "2025-01-23T16:17:59.430459Z",
"url": "https://files.pythonhosted.org/packages/1e/b2/2ae548c1f56cc282820ccc382c9dfebaf5f84b1e7524e08c7fd1c9ef8867/streamlit_pivottable-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9e694c72f2f888d6553b2a5f0d33e0877c5d0c14ad23c0151c04ae21b1a9a4c3",
"md5": "bc90dc55853599c6b9c846796fcdc0d7",
"sha256": "fb6c1d330a901ea10ecc509d71ffe7c54f7dc9d2475eb0be3857ab03fed891ab"
},
"downloads": -1,
"filename": "streamlit_pivottable-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "bc90dc55853599c6b9c846796fcdc0d7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 1919788,
"upload_time": "2025-01-23T16:18:14",
"upload_time_iso_8601": "2025-01-23T16:18:14.468180Z",
"url": "https://files.pythonhosted.org/packages/9e/69/4c72f2f888d6553b2a5f0d33e0877c5d0c14ad23c0151c04ae21b1a9a4c3/streamlit_pivottable-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-23 16:18:14",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "streamlit-pivottable"
}