From 2c95819b2e48aaa2771d2715fbafe1a87f27ed43 Mon Sep 17 00:00:00 2001 From: Dayenne Souza Date: Tue, 29 Oct 2024 21:41:37 -0300 Subject: [PATCH 1/6] change fix_null_ints --- app/util/df_functions.py | 5 +- example_notebooks/anonymize_case_data.ipynb | 1333 +++++++++++-------- poetry.lock | 23 +- pyproject.toml | 1 + 4 files changed, 775 insertions(+), 587 deletions(-) diff --git a/app/util/df_functions.py b/app/util/df_functions.py index 36a24861..206fbf38 100644 --- a/app/util/df_functions.py +++ b/app/util/df_functions.py @@ -1,7 +1,8 @@ # Copyright (c) 2024 Microsoft Corporation. All rights reserved. import math -import sys import re +import sys + import numpy as np import pandas as pd from dateutil import parser as dateparser @@ -22,7 +23,7 @@ def fix_null_ints(in_df): isum = idf["int"].sum() if int(fsum) == int(isum): df[col] = idf["int_s"] - df[col] = df[col].astype("Int64") + df[col] = df[col].astype(str) df[col] = df[col].replace(-sys.maxsize, np.nan) return df diff --git a/example_notebooks/anonymize_case_data.ipynb b/example_notebooks/anonymize_case_data.ipynb index 5b143213..a314767d 100644 --- a/example_notebooks/anonymize_case_data.ipynb +++ b/example_notebooks/anonymize_case_data.ipynb @@ -13,19 +13,24 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ "import sys\n", + "\n", "sys.path.append(\"..\")\n", - "from toolkit.anonymize_case_data import AnonymizeCaseData, SynthesizabilityStatistics, color_schemes\n", + "from toolkit.anonymize_case_data import (\n", + " AnonymizeCaseData,\n", + " SynthesizabilityStatistics,\n", + " color_schemes,\n", + ")\n", "import pandas as pd" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -40,35 +45,35 @@ "# Create the workflow object\n", "acd = AnonymizeCaseData()\n", "# Load the sensitive data\n", - "data_path = \"../example_outputs/anonymize_case_data/customer_complaints/customer_complaints_prepared.csv\"\n", + "data_path = \"../example_outputs/customer_complaints_prepared.csv\"\n", "sensitive_data = pd.read_csv(data_path)\n", - "# Map missing values and binary False to empty strings, since we only care about the presence of attributes\n", - "sensitive_data = sensitive_data.astype(str).replace(\"False\", \"\").replace(\"nan\", \"\")\n", "print(\"Loaded data\")" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 18, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "SynthesizabilityStatistics(num_cols=9, overall_att_count=101, possible_combinations=27648, possible_combinations_per_row=9.2, mean_vals_per_record=5.409, max_combinations_per_record=42.488485068238006, excess_combinations_ratio=0.21652925457861052)\n" + "SynthesizabilityStatistics(num_cols=11, overall_att_count=208, possible_combinations=176947200, possible_combinations_per_row=59041.4, mean_vals_per_record=10.916583249916583, max_combinations_per_record=1932.9428262222075, excess_combinations_ratio=30.54482481274007)\n" ] } ], "source": [ "# Check the synthesizabiluty of the data\n", - "synthesizability_stats: SynthesizabilityStatistics = acd.analyze_synthesizability(sensitive_data)\n", + "synthesizability_stats: SynthesizabilityStatistics = acd.analyze_synthesizability(\n", + " sensitive_data\n", + ")\n", "print(synthesizability_stats)" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -90,19 +95,19 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 20, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - " selections protected_count\n", - "7161 record_count 3115\n", - "7072 age_range:(30-40] 1285\n", - "4221 period:2023-H2 1085\n", - "1689 period:2023-H1 1069\n", - "1149 quality_issue:True 957\n" + " selections protected_count\n", + "25355 record_count 3010\n", + "15237 description_issue:False 2277\n", + "3885 delivery_issue:False 2104\n", + "1731 service_issue:False 2067\n", + "21245 price_issue:False 2056\n" ] } ], @@ -113,37 +118,7 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " city age_range price_issue quality_issue service_issue \\\n", - "0 Mountainview (40-50] True \n", - "1 Mountainview (40-50] True \n", - "2 (20-30] True \n", - "3 (20-30] True \n", - "4 (20-30] True \n", - "\n", - " delivery_issue description_issue product_code period \n", - "0 True True C 2023-H1 \n", - "1 True True C 2023-H2 \n", - "2 True True C 2023-H2 \n", - "3 True True C 2023-H2 \n", - "4 True True C 2023-H1 \n" - ] - } - ], - "source": [ - "# Inspect the anonymous synthetic data\n", - "print(acd.synthetic_df.head())" - ] - }, - { - "cell_type": "code", - "execution_count": 7, + "execution_count": 21, "metadata": {}, "outputs": [ { @@ -151,11 +126,11 @@ "output_type": "stream", "text": [ " Length Count +/- Error Suppressed % Fabricated %\n", - "0 1 160.66 +/- 5.72 4.07 % 0.00 %\n", - "1 2 23.85 +/- 5.19 9.19 % 0.21 %\n", - "2 3 6.85 +/- 3.66 17.78 % 2.61 %\n", - "3 4 2.85 +/- 2.22 36.81 % 7.84 %\n", - "4 Overall 6.88 +/- 3.07 17.95 % 2.53 %\n" + "0 1 147.06 +/- 8.50 9.99 % 0.00 %\n", + "1 2 20.97 +/- 7.61 21.00 % 0.50 %\n", + "2 3 6.66 +/- 6.60 34.40 % 2.30 %\n", + "3 4 3.23 +/- 5.26 51.55 % 1.84 %\n", + "4 Overall 4.46 +/- 5.79 41.84 % 1.73 %\n" ] } ], @@ -172,7 +147,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 22, "metadata": {}, "outputs": [ { @@ -180,11 +155,11 @@ "output_type": "stream", "text": [ " Length Count +/- Error Suppressed % Fabricated %\n", - "0 1 160.66 +/- 5.72 4.07 % 0.00 %\n", - "1 2 23.85 +/- 11.05 9.19 % 0.11 %\n", - "2 3 6.85 +/- 5.19 18.58 % 1.29 %\n", - "3 4 2.85 +/- 2.65 40.03 % 4.69 %\n", - "4 Overall 6.88 +/- 4.54 18.98 % 1.14 %\n" + "0 1 147.06 +/- 8.50 9.99 % 0.00 %\n", + "1 2 20.97 +/- 29.91 21.03 % 0.24 %\n", + "2 3 6.66 +/- 21.26 35.79 % 0.56 %\n", + "3 4 3.23 +/- 16.47 54.05 % 0.42 %\n", + "4 Overall 4.46 +/- 18.84 43.66 % 0.40 %\n" ] } ], @@ -201,7 +176,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 23, "metadata": {}, "outputs": [ { @@ -213,189 +188,189 @@ "data": [ { "alignmentgroup": "True", - "hovertemplate": "Attribute=age_range
Attribute Value=%{x}
Count=%{y}", - "legendgroup": "age_range", + "hovertemplate": "Attribute=description_issue
Attribute Value=%{x}
Count=%{y}", + "legendgroup": "description_issue", "marker": { "color": "#AA0DFE", "pattern": { "shape": "" } }, - "name": "age_range", - "offsetgroup": "age_range", + "name": "description_issue", + "offsetgroup": "description_issue", "orientation": "v", "showlegend": true, "textposition": "auto", "texttemplate": "%{y}", "type": "bar", "x": [ - "age_range:(30-40]", - "age_range:(20-30]", - "age_range:(40-50]" + "description_issue:False" ], "xaxis": "x", "y": [ - 1285, - 767, - 764 + 2277 ], "yaxis": "y" }, { "alignmentgroup": "True", - "hovertemplate": "Attribute=period
Attribute Value=%{x}
Count=%{y}", - "legendgroup": "period", + "hovertemplate": "Attribute=delivery_issue
Attribute Value=%{x}
Count=%{y}", + "legendgroup": "delivery_issue", "marker": { "color": "#3283FE", "pattern": { "shape": "" } }, - "name": "period", - "offsetgroup": "period", + "name": "delivery_issue", + "offsetgroup": "delivery_issue", "orientation": "v", "showlegend": true, "textposition": "auto", "texttemplate": "%{y}", "type": "bar", "x": [ - "period:2023-H2", - "period:2023-H1" + "delivery_issue:False" ], "xaxis": "x", "y": [ - 1085, - 1069 + 2104 ], "yaxis": "y" }, { "alignmentgroup": "True", - "hovertemplate": "Attribute=quality_issue
Attribute Value=%{x}
Count=%{y}", - "legendgroup": "quality_issue", + "hovertemplate": "Attribute=service_issue
Attribute Value=%{x}
Count=%{y}", + "legendgroup": "service_issue", "marker": { "color": "#85660D", "pattern": { "shape": "" } }, - "name": "quality_issue", - "offsetgroup": "quality_issue", + "name": "service_issue", + "offsetgroup": "service_issue", "orientation": "v", "showlegend": true, "textposition": "auto", "texttemplate": "%{y}", "type": "bar", "x": [ - "quality_issue:True" + "service_issue:False", + "service_issue:True" ], "xaxis": "x", "y": [ - 957 + 2067, + 947 ], "yaxis": "y" }, { "alignmentgroup": "True", - "hovertemplate": "Attribute=service_issue
Attribute Value=%{x}
Count=%{y}", - "legendgroup": "service_issue", + "hovertemplate": "Attribute=price_issue
Attribute Value=%{x}
Count=%{y}", + "legendgroup": "price_issue", "marker": { "color": "#782AB6", "pattern": { "shape": "" } }, - "name": "service_issue", - "offsetgroup": "service_issue", + "name": "price_issue", + "offsetgroup": "price_issue", "orientation": "v", "showlegend": true, "textposition": "auto", "texttemplate": "%{y}", "type": "bar", "x": [ - "service_issue:True" + "price_issue:False" ], "xaxis": "x", "y": [ - 941 + 2056 ], "yaxis": "y" }, { "alignmentgroup": "True", - "hovertemplate": "Attribute=price_issue
Attribute Value=%{x}
Count=%{y}", - "legendgroup": "price_issue", + "hovertemplate": "Attribute=quality_issue
Attribute Value=%{x}
Count=%{y}", + "legendgroup": "quality_issue", "marker": { "color": "#565656", "pattern": { "shape": "" } }, - "name": "price_issue", - "offsetgroup": "price_issue", + "name": "quality_issue", + "offsetgroup": "quality_issue", "orientation": "v", "showlegend": true, "textposition": "auto", "texttemplate": "%{y}", "type": "bar", "x": [ - "price_issue:True" + "quality_issue:False", + "quality_issue:True" ], "xaxis": "x", "y": [ - 932 + 2049, + 934 ], "yaxis": "y" }, { "alignmentgroup": "True", - "hovertemplate": "Attribute=delivery_issue
Attribute Value=%{x}
Count=%{y}", - "legendgroup": "delivery_issue", + "hovertemplate": "Attribute=age_range
Attribute Value=%{x}
Count=%{y}", + "legendgroup": "age_range", "marker": { "color": "#1C8356", "pattern": { "shape": "" } }, - "name": "delivery_issue", - "offsetgroup": "delivery_issue", + "name": "age_range", + "offsetgroup": "age_range", "orientation": "v", "showlegend": true, "textposition": "auto", "texttemplate": "%{y}", "type": "bar", "x": [ - "delivery_issue:True" + "age_range:(30-40]" ], "xaxis": "x", "y": [ - 904 + 1296 ], "yaxis": "y" }, { "alignmentgroup": "True", - "hovertemplate": "Attribute=description_issue
Attribute Value=%{x}
Count=%{y}", - "legendgroup": "description_issue", + "hovertemplate": "Attribute=period
Attribute Value=%{x}
Count=%{y}", + "legendgroup": "period", "marker": { "color": "#16FF32", "pattern": { "shape": "" } }, - "name": "description_issue", - "offsetgroup": "description_issue", + "name": "period", + "offsetgroup": "period", "orientation": "v", "showlegend": true, "textposition": "auto", "texttemplate": "%{y}", "type": "bar", "x": [ - "description_issue:True" + "period:2023-H2", + "period:2023-H1" ], "xaxis": "x", "y": [ - 723 + 1087, + 1065 ], "yaxis": "y" } @@ -1251,7 +1226,34 @@ } } } - } + }, + "text/html": [ + "
" + ] }, "metadata": {}, "output_type": "display_data" @@ -1260,20 +1262,20 @@ "source": [ "# Create example top attributes bar chart\n", "bar_chart, bar_chart_df = acd.get_bar_chart_fig(\n", - " selection=[], # Prefilter the dataset by adding attribute values here\n", + " selection=[], # Prefilter the dataset by adding attribute values here\n", " show_attributes=[],\n", " unit=\"Customer\",\n", " width=1000,\n", " height=600,\n", " scheme=color_schemes[\"Alphabet\"],\n", - " num_values=10\n", + " num_values=10,\n", ")\n", "bar_chart.show()" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 24, "metadata": {}, "outputs": [ { @@ -1283,11 +1285,51 @@ "plotlyServerURL": "https://plot.ly" }, "data": [ + { + "hovertemplate": "Attribute Value=delivery_issue:False
period=%{x}
Count=%{y}", + "legendgroup": "delivery_issue:False", + "line": { + "color": "#AA0DFE", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "delivery_issue:False", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + "2020-H1", + "2020-H2", + "2021-H1", + "2021-H2", + "2022-H1", + "2022-H2", + "2023-H1", + "2023-H2", + "2024-H1" + ], + "xaxis": "x", + "y": [ + 46, + 104, + 87, + 121, + 109, + 147, + 721, + 741, + 49 + ], + "yaxis": "y" + }, { "hovertemplate": "Attribute Value=delivery_issue:True
period=%{x}
Count=%{y}", "legendgroup": "delivery_issue:True", "line": { - "color": "#AA0DFE", + "color": "#3283FE", "dash": "solid" }, "marker": { @@ -1311,15 +1353,55 @@ ], "xaxis": "x", "y": [ - 12, - 18, - 24, - 49, - 20, - 77, - 331, - 351, - 13 + 10, + 37, + 29, + 37, + 13, + 67, + 338, + 354, + 0 + ], + "yaxis": "y" + }, + { + "hovertemplate": "Attribute Value=description_issue:False
period=%{x}
Count=%{y}", + "legendgroup": "description_issue:False", + "line": { + "color": "#85660D", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "description_issue:False", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + "2020-H1", + "2020-H2", + "2021-H1", + "2021-H2", + "2022-H1", + "2022-H2", + "2023-H1", + "2023-H2", + "2024-H1" + ], + "xaxis": "x", + "y": [ + 50, + 85, + 88, + 121, + 124, + 172, + 781, + 816, + 18 ], "yaxis": "y" }, @@ -1327,7 +1409,7 @@ "hovertemplate": "Attribute Value=description_issue:True
period=%{x}
Count=%{y}", "legendgroup": "description_issue:True", "line": { - "color": "#3283FE", + "color": "#782AB6", "dash": "solid" }, "marker": { @@ -1351,15 +1433,55 @@ ], "xaxis": "x", "y": [ - 6, - 27, - 11, - 16, - 21, - 38, - 305, - 259, - 6 + 0, + 29, + 0, + 32, + 30, + 42, + 285, + 268, + 34 + ], + "yaxis": "y" + }, + { + "hovertemplate": "Attribute Value=price_issue:False
period=%{x}
Count=%{y}", + "legendgroup": "price_issue:False", + "line": { + "color": "#565656", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "price_issue:False", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + "2020-H1", + "2020-H2", + "2021-H1", + "2021-H2", + "2022-H1", + "2022-H2", + "2023-H1", + "2023-H2", + "2024-H1" + ], + "xaxis": "x", + "y": [ + 18, + 83, + 65, + 123, + 100, + 157, + 676, + 755, + 26 ], "yaxis": "y" }, @@ -1367,7 +1489,7 @@ "hovertemplate": "Attribute Value=price_issue:True
period=%{x}
Count=%{y}", "legendgroup": "price_issue:True", "line": { - "color": "#85660D", + "color": "#1C8356", "dash": "solid" }, "marker": { @@ -1391,23 +1513,63 @@ ], "xaxis": "x", "y": [ - 8, - 18, + 0, + 21, 33, - 42, - 60, - 61, - 384, + 29, + 46, + 76, + 390, 321, 0 ], "yaxis": "y" }, + { + "hovertemplate": "Attribute Value=quality_issue:False
period=%{x}
Count=%{y}", + "legendgroup": "quality_issue:False", + "line": { + "color": "#16FF32", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "quality_issue:False", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + "2020-H1", + "2020-H2", + "2021-H1", + "2021-H2", + "2022-H1", + "2022-H2", + "2023-H1", + "2023-H2", + "2024-H1" + ], + "xaxis": "x", + "y": [ + 24, + 84, + 49, + 118, + 90, + 152, + 729, + 717, + 34 + ], + "yaxis": "y" + }, { "hovertemplate": "Attribute Value=quality_issue:True
period=%{x}
Count=%{y}", "legendgroup": "quality_issue:True", "line": { - "color": "#782AB6", + "color": "#F7E1A0", "dash": "solid" }, "marker": { @@ -1431,15 +1593,55 @@ ], "xaxis": "x", "y": [ - 13, - 32, - 36, - 20, - 61, - 60, - 337, - 368, - 6 + 10, + 35, + 37, + 14, + 51, + 69, + 363, + 361, + 9 + ], + "yaxis": "y" + }, + { + "hovertemplate": "Attribute Value=service_issue:False
period=%{x}
Count=%{y}", + "legendgroup": "service_issue:False", + "line": { + "color": "#E2E2E2", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "service_issue:False", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + "2020-H1", + "2020-H2", + "2021-H1", + "2021-H2", + "2022-H1", + "2022-H2", + "2023-H1", + "2023-H2", + "2024-H1" + ], + "xaxis": "x", + "y": [ + 28, + 62, + 87, + 87, + 120, + 163, + 753, + 732, + 31 ], "yaxis": "y" }, @@ -1447,7 +1649,7 @@ "hovertemplate": "Attribute Value=service_issue:True
period=%{x}
Count=%{y}", "legendgroup": "service_issue:True", "line": { - "color": "#565656", + "color": "#1CBE4F", "dash": "solid" }, "marker": { @@ -1471,15 +1673,15 @@ ], "xaxis": "x", "y": [ - 9, + 24, 43, - 11, - 50, - 39, - 37, - 318, - 368, - 11 + 30, + 49, + 32, + 54, + 329, + 378, + 15 ], "yaxis": "y" } @@ -2333,7 +2535,34 @@ } } } - } + }, + "text/html": [ + "
" + ] }, "metadata": {}, "output_type": "display_data" @@ -2342,20 +2571,26 @@ "source": [ "# Create example time series line chart\n", "line_chart, line_chart_df = acd.get_line_chart_fig(\n", - " selection=[], # Prefilter the dataset by adding attribute values here\n", - " series_attributes=[\"quality_issue\", \"price_issue\", \"service_issue\", \"delivery_issue\", \"description_issue\"],\n", + " selection=[], # Prefilter the dataset by adding attribute values here\n", + " series_attributes=[\n", + " \"quality_issue\",\n", + " \"price_issue\",\n", + " \"service_issue\",\n", + " \"delivery_issue\",\n", + " \"description_issue\",\n", + " ],\n", " time_attribute=\"period\",\n", " unit=\"Customer\",\n", " width=1000,\n", " height=600,\n", - " scheme=color_schemes[\"Alphabet\"]\n", + " scheme=color_schemes[\"Alphabet\"],\n", ")\n", "line_chart.show()" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 25, "metadata": {}, "outputs": [ { @@ -2368,346 +2603,318 @@ { "link": { "color": [ - "#b6a5bf", - "#b3afb5", - "#be89db", - "#b89fc5", - "#b6a4c0", - "#b99cc8", - "#b7a0c4", + "#c083e1", + "#b2b2b2", "#bc90d4", - "#bc92d2", + "#b6a6be", + "#b5aaba", + "#b89dc7", + "#b99cc8", + "#b5a9bb", + "#b7a1c3", + "#b2b2b2", + "#b99bc9", + "#b2b2b2", + "#c084e0", + "#c76cf8", + "#b3aeb6", + "#c573f1", + "#c965ff", + "#b99cc8", + "#b89fc5", + "#c868fc", + "#b89fc5", + "#b2b2b2", + "#bb94d0", + "#be8bd9", + "#b2b2b2", + "#bf87dd", + "#bc91d3", + "#bb93d1", + "#b99aca", "#ba97cd", "#b99aca", - "#bf86de", - "#bb94d0", "#b4adb7", - "#ba99cb", + "#bc90d4", "#bf88dc", - "#c476ee", - "#b99cc8", - "#b99aca", - "#b7a1c3", - "#b99aca", - "#b4aaba", - "#b7a0c4", "#bc90d4", - "#b89dc7", - "#b7a3c1", - "#b89fc5", + "#b99bc9", + "#b6a6be", + "#b6a6be", "#b4acb8", - "#b89ec6", - "#c085df", - "#b6a4c0", - "#b4abb9", - "#c475ef", - "#bc92d2", - "#b2b2b2", - "#b89fc5", + "#b7a3c1", "#b2b2b2", - "#c475ef", - "#bb93d1", "#b7a2c2", - "#b6a6be", - "#ba99cb", - "#b99cc8", + "#c27de7", "#b2b2b2", - "#bd8ed6", - "#c181e3", - "#c573f1", - "#b5aaba", - "#c181e3", - "#b3aeb6", - "#c27ee6", - "#bc91d3", - "#b89fc5", + "#b3afb5", + "#bb95cf", + "#c965ff", "#b2b2b2", - "#bb93d1", + "#c084e0", + "#b99bc9", "#b2b2b2", + "#c27ee6", + "#c86afa", "#ba99cb", + "#c965ff", + "#be89db", "#b2b2b2", "#b2b2b2", "#b2b2b2", "#b2b2b2", + "#bb95cf", + "#c083e1", "#b2b2b2", - "#b2b2b2", + "#bd8cd8", + "#c76cf8", "#c965ff", "#b2b2b2", - "#b6a6be", - "#c965ff", "#bd8cd8", - "#bb93d1", - "#c37be9", - "#b6a4c0", - "#c082e2", - "#b2b2b2", - "#b2b2b2", - "#be89db", + "#b4acb8", "#b2b2b2", "#c965ff", - "#b4aaba", - "#c084e0", "#b2b2b2", + "#b99bc9", "#b2b2b2", - "#c379eb", - "#c965ff", - "#c379eb", - "#c965ff", "#b2b2b2", "#b2b2b2", - "#c965ff", + "#ba99cb", "#b2b2b2", "#b2b2b2", - "#c180e4", - "#b2b2b2", - "#b6a6be", "#b2b2b2", "#b2b2b2", "#c965ff", - "#bb93d1", + "#bc92d2", + "#b2b2b2", + "#b5a7bd", "#b2b2b2", - "#b2b2b2" + "#c965ff" ], "customdata": [ [ - 20, - 0.17699115044247787 - ], - [ - 5, - 0.046296296296296294 - ], - [ - 55, - 0.5445544554455446 - ], - [ - 19, - 0.25333333333333335 + 65, + 0.6190476190476191 ], [ - 13, - 0.18055555555555555 + 0, + 0 ], [ - 16, - 0.2909090909090909 + 44, + 0.4536082474226804 ], [ - 13, - 0.23636363636363636 + 12, + 0.1643835616438356 ], [ - 23, - 0.4423076923076923 + 8, + 0.11594202898550725 ], [ - 21, - 0.42857142857142855 + 15, + 0.28846153846153844 ], [ - 16, - 0.35555555555555557 + 15, + 0.29411764705882354 ], [ - 14, - 0.3181818181818182 + 6, + 0.12 ], [ - 24, - 0.5714285714285714 + 10, + 0.22727272727272727 ], [ - 16, - 0.3902439024390244 + 0, + 0 ], [ - 3, - 0.07894736842105263 + 13, + 0.3023255813953488 ], [ - 12, - 0.3333333333333333 + 0, + 0 ], [ - 19, - 0.5588235294117647 + 25, + 0.6097560975609756 ], [ - 27, - 0.7941176470588235 + 38, + 0.926829268292683 ], [ - 10, - 0.29411764705882354 + 2, + 0.05 ], [ - 10, - 0.3225806451612903 + 32, + 0.8205128205128205 ], [ - 7, - 0.22580645161290322 + 38, + 1 ], [ - 10, - 0.3225806451612903 + 11, + 0.2972972972972973 ], [ - 3, - 0.10714285714285714 + 9, + 0.25 ], [ - 6, - 0.23076923076923078 + 35, + 0.9722222222222222 ], [ - 11, - 0.44 + 9, + 0.25 ], [ - 7, - 0.28 + 0, + 0 ], [ - 5, - 0.2 + 13, + 0.3939393939393939 ], [ - 6, - 0.25 + 16, + 0.5161290322580645 ], [ - 2, - 0.08695652173913043 + 0, + 0 ], [ - 6, - 0.2608695652173913 + 17, + 0.5666666666666667 ], [ 13, - 0.5909090909090909 + 0.43333333333333335 ], [ - 4, - 0.18181818181818182 + 12, + 0.4 ], [ - 2, - 0.09090909090909091 + 9, + 0.3103448275862069 ], [ - 17, - 0.8095238095238095 + 10, + 0.35714285714285715 ], [ 9, - 0.42857142857142855 + 0.32142857142857145 ], [ - 0, - 0 + 2, + 0.07142857142857142 ], [ - 5, - 0.25 + 12, + 0.4444444444444444 ], [ - 0, - 0 + 15, + 0.5555555555555556 ], [ - 16, - 0.8 + 12, + 0.4444444444444444 ], [ 8, - 0.4 + 0.3076923076923077 ], [ 4, - 0.21052631578947367 + 0.16 ], [ - 3, - 0.16666666666666666 + 4, + 0.16 ], [ - 6, - 0.3333333333333333 + 2, + 0.08333333333333333 ], [ 5, - 0.29411764705882354 + 0.20833333333333334 ], [ 0, 0 ], [ - 8, - 0.47058823529411764 + 5, + 0.21739130434782608 ], [ - 11, - 0.6470588235294118 + 16, + 0.6956521739130435 ], [ - 14, - 0.8235294117647058 + 0, + 0 ], [ - 2, - 0.11764705882352941 + 1, + 0.047619047619047616 ], [ - 11, - 0.6470588235294118 + 8, + 0.38095238095238093 ], [ - 1, - 0.058823529411764705 + 21, + 1 ], [ - 11, - 0.6875 + 0, + 0 ], [ - 7, - 0.4375 + 12, + 0.6 ], [ - 4, - 0.25 + 6, + 0.3 ], [ 0, 0 ], [ - 6, - 0.4 + 13, + 0.6842105263157895 ], [ - 0, - 0 + 17, + 0.9444444444444444 ], [ - 5, + 6, 0.3333333333333333 ], [ - 0, - 0 - ], - [ - 0, - 0 + 18, + 1 ], [ - 0, - 0 + 8, + 0.5333333333333333 ], [ 0, @@ -2721,45 +2928,17 @@ 0, 0 ], - [ - 12, - 1 - ], [ 0, 0 ], - [ - 2, - 0.16666666666666666 - ], - [ - 12, - 1 - ], - [ - 6, - 0.5 - ], [ 5, - 0.4166666666666667 + 0.38461538461538464 ], [ 8, - 0.7272727272727273 - ], - [ - 2, - 0.18181818181818182 - ], - [ - 7, - 0.6363636363636364 - ], - [ - 0, - 0 + 0.6153846153846154 ], [ 0, @@ -2767,46 +2946,34 @@ ], [ 6, - 0.5454545454545454 + 0.5 ], [ - 0, - 0 + 11, + 0.9166666666666666 ], [ - 10, + 12, 1 ], - [ - 1, - 0.1 - ], - [ - 6, - 0.6 - ], - [ - 0, - 0 - ], [ 0, 0 ], [ 6, - 0.75 + 0.5 ], [ - 8, - 1 + 1, + 0.08333333333333333 ], [ - 6, - 0.75 + 0, + 0 ], [ - 8, + 11, 1 ], [ @@ -2814,12 +2981,12 @@ 0 ], [ - 0, - 0 + 3, + 0.3 ], [ - 7, - 1 + 0, + 0 ], [ 0, @@ -2830,16 +2997,16 @@ 0 ], [ - 4, - 0.6666666666666666 + 3, + 0.3333333333333333 ], [ 0, 0 ], [ - 1, - 0.16666666666666666 + 0, + 0 ], [ 0, @@ -2850,261 +3017,257 @@ 0 ], [ - 5, + 7, 1 ], [ - 2, - 0.4 + 3, + 0.42857142857142855 ], [ 0, 0 ], + [ + 1, + 0.14285714285714285 + ], [ 0, 0 + ], + [ + 6, + 1 ] ], - "hovertemplate": "city: %{source.label} + product_code: %{target.label} = %{value:.0f}
+ price_issue:True = %{customdata[0]}
Proportion = %{customdata[1]:.1%}", - "source": [ - 11, - 13, - 22, - 22, - 20, - 13, + "hovertemplate": "city: %{source.label} + product_code: %{target.label} = %{value:.0f}
+ price_issue:True = %{customdata[0]}
Proportion = %{customdata[1]:.1%}", + "source": [ 22, 13, - 16, 11, 20, + 22, + 23, + 16, 13, - 15, - 19, 13, - 9, - 19, - 24, - 20, 11, 2, - 11, - 11, - 19, + 12, + 2, 13, + 20, + 22, + 19, 15, - 21, - 13, - 12, 19, 11, - 2, - 2, - 24, - 18, - 18, 13, 19, - 23, - 2, + 22, + 21, 21, - 12, - 20, 9, + 13, 21, + 13, + 22, + 11, + 16, 17, - 7, 20, 16, - 9, - 21, - 9, - 9, 12, 18, - 14, - 19, - 16, - 7, + 9, 22, - 24, - 23, - 18, + 2, + 12, + 16, 19, + 9, + 21, 12, - 23, 21, - 22, - 17, - 19, - 16, 16, + 7, 9, - 17, - 11, + 19, + 15, + 20, + 18, 23, + 13, 21, - 22, - 22, - 7, - 14, - 7, 20, - 24, - 21, - 12, - 14, - 9, - 7, + 11, + 11, + 15, + 16, 14, - 24, - 18, 12, + 2, + 22, 14, + 18, + 15, + 17, + 17, + 7, + 7, + 9, + 2, + 9, + 15, + 17, + 23, 15, + 23, + 19, + 12, + 21, 2, 21, - 18, - 7 + 17 ], "target": [ - 4, - 3, 0, - 8, - 1, - 4, 3, + 4, 1, - 3, - 10, - 0, - 0, - 5, - 10, 8, 5, - 0, - 5, - 6, 3, - 6, - 5, + 1, + 4, 8, + 4, + 4, 6, - 6, - 8, - 8, - 10, - 5, + 0, + 0, + 3, + 0, 5, 1, + 10, + 10, + 6, 1, + 0, + 8, 4, 6, - 0, - 5, + 10, + 8, + 4, 5, 8, + 8, 6, 0, + 3, + 5, 10, - 4, + 10, + 0, 10, 6, - 3, - 8, - 3, - 3, - 1, - 3, 5, 1, - 10, - 8, - 8, + 3, 6, + 5, 4, + 3, 5, 10, - 5, - 4, 8, - 6, - 3, - 6, - 4, - 6, - 6, + 10, 6, 1, - 6, - 8, + 5, 4, + 8, + 1, 3, + 10, + 10, 6, + 0, 5, + 5, + 5, + 8, 1, - 10, - 1, + 4, + 6, + 8, 1, - 3, 0, + 3, 8, - 8, - 0, + 4, 0, - 1, 8, - 6, - 10, 0, + 4, 3, 1, + 6, 8, - 3, - 8, - 4, - 10, - 5 + 1, + 10 ], "value": [ - 113, - 108, - 101, - 75, - 72, - 55, - 55, + 105, + 100, + 97, + 73, + 69, 52, - 49, - 45, + 51, + 50, 44, + 43, + 43, 42, 41, + 41, + 40, + 39, 38, + 37, 36, - 34, - 34, - 34, - 31, + 36, + 36, + 33, + 33, 31, 31, + 30, + 30, + 30, + 29, 28, + 28, + 28, + 27, + 27, + 27, 26, 25, 25, - 25, + 24, 24, 23, 23, - 22, - 22, - 22, + 23, + 21, + 21, 21, 21, - 20, 20, 20, 20, @@ -3112,25 +3275,13 @@ 19, 18, 18, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 16, - 16, - 16, - 15, + 18, 15, 15, 15, 15, 14, - 14, - 14, + 13, 13, 13, 12, @@ -3142,33 +3293,21 @@ 11, 11, 11, - 11, - 11, - 11, - 10, 10, 10, 10, 9, - 8, - 8, - 8, + 9, + 9, + 9, 8, 8, 7, 7, 7, 7, - 6, - 6, - 6, - 6, - 6, - 5, - 5, - 5, - 5, - 4 + 7, + 6 ] }, "node": { @@ -3197,7 +3336,6 @@ "Rivertown", "Seaside", "Springfield", - "Sunnyvale", "Valleyview" ], "line": { @@ -4036,7 +4174,34 @@ }, "width": 1000 } - } + }, + "text/html": [ + "
" + ] }, "metadata": {}, "output_type": "display_data" @@ -4045,14 +4210,14 @@ "source": [ "# Create example alluvial/flow chart of city-product relationships\n", "flow_chart, flow_chart_df = acd.get_flow_chart_fig(\n", - " selection=[], # Prefilter the dataset by adding attribute values here\n", + " selection=[], # Prefilter the dataset by adding attribute values here\n", " source_attribute=\"city\",\n", " target_attribute=\"product_code\",\n", " highlight_attribute=\"price_issue:True\",\n", " unit=\"Customer\",\n", " width=1000,\n", " height=600,\n", - " scheme=color_schemes[\"Alphabet\"]\n", + " scheme=color_schemes[\"Alphabet\"],\n", ")\n", "flow_chart.show()" ] @@ -4060,7 +4225,7 @@ ], "metadata": { "kernelspec": { - "display_name": "intelligence-toolkit-lXFNld9n-py3.11", + "display_name": ".venv", "language": "python", "name": "python3" }, diff --git a/poetry.lock b/poetry.lock index f09b0ba8..527954ed 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2532,6 +2532,27 @@ files = [ [package.dependencies] dill = ">=0.3.9" +[[package]] +name = "nbformat" +version = "5.10.4" +description = "The Jupyter Notebook format" +optional = false +python-versions = ">=3.8" +files = [ + {file = "nbformat-5.10.4-py3-none-any.whl", hash = "sha256:3b48d6c8fbca4b299bf3982ea7db1af21580e4fec269ad087b9e81588891200b"}, + {file = "nbformat-5.10.4.tar.gz", hash = "sha256:322168b14f937a5d11362988ecac2a4952d3d8e3a2cbeb2319584631226d5b3a"}, +] + +[package.dependencies] +fastjsonschema = ">=2.15" +jsonschema = ">=2.6" +jupyter-core = ">=4.12,<5.0.dev0 || >=5.1.dev0" +traitlets = ">=5.1" + +[package.extras] +docs = ["myst-parser", "pydata-sphinx-theme", "sphinx", "sphinxcontrib-github-alt", "sphinxcontrib-spelling"] +test = ["pep440", "pre-commit", "pytest", "testpath"] + [[package]] name = "nest-asyncio" version = "1.6.0" @@ -5942,4 +5963,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = ">=3.11,<3.13" -content-hash = "90746991bc9de74e56af48b361c9bf9a7975b9a69ee38b14f89e16c16edb7993" +content-hash = "8f64f6f998ff8eb8a1a93ca40637526c512703d2b6bcb6e8cced10847434c958" diff --git a/pyproject.toml b/pyproject.toml index f4d6d72b..12449df4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,6 +62,7 @@ pytest = "^8.2.2" pytest-asyncio = "^0.23.7" pytest-mock = "^3.14.0" faker = "^28.0.0" +nbformat = "^5.10.4" [[tool.poetry.source]] From 2e7cf26722ad81aaddd183487ba68c50bdb04d77 Mon Sep 17 00:00:00 2001 From: Dayenne Souza Date: Wed, 30 Oct 2024 10:17:12 -0300 Subject: [PATCH 2/6] fix_null_int --- app/util/df_functions.py | 22 +- example_notebooks/anonymize_case_data.ipynb | 1022 ++++++++++--------- 2 files changed, 543 insertions(+), 501 deletions(-) diff --git a/app/util/df_functions.py b/app/util/df_functions.py index 206fbf38..b2df54b0 100644 --- a/app/util/df_functions.py +++ b/app/util/df_functions.py @@ -1,31 +1,19 @@ # Copyright (c) 2024 Microsoft Corporation. All rights reserved. import math import re -import sys -import numpy as np import pandas as pd from dateutil import parser as dateparser -def fix_null_ints(in_df): +def fix_null_ints(in_df: pd.DataFrame) -> pd.DataFrame: df = in_df.copy() for col, dt in zip(df.columns, df.dtypes, strict=False): if dt == "float64": - idf = df[[col]].copy() - idf["float"] = [x if not np.isnan(x) else 0 for x in idf[col]] - idf["int"] = [int(x) if not np.isnan(x) else 0 for x in idf[col]] - idf["float_s"] = [x if not np.isnan(x) else -sys.maxsize for x in idf[col]] - idf["int_s"] = [ - int(x) if not np.isnan(x) else -sys.maxsize for x in idf[col] - ] - fsum = idf["float"].sum() - isum = idf["int"].sum() - if int(fsum) == int(isum): - df[col] = idf["int_s"] - df[col] = df[col].astype(str) - df[col] = df[col].replace(-sys.maxsize, np.nan) - return df + df[col] = df[col].astype("Int64") + df[col] = df[col].where(pd.notna(df[col]), pd.NA) + + return df.astype(str).replace("", "") def get_current_time(): diff --git a/example_notebooks/anonymize_case_data.ipynb b/example_notebooks/anonymize_case_data.ipynb index a314767d..d5591a97 100644 --- a/example_notebooks/anonymize_case_data.ipynb +++ b/example_notebooks/anonymize_case_data.ipynb @@ -13,9 +13,18 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/ddesouza/Projects/intelligence-toolkit/.venv/lib/python3.11/site-packages/sentence_transformers/cross_encoder/CrossEncoder.py:13: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", + " from tqdm.autonotebook import tqdm, trange\n" + ] + } + ], "source": [ "import sys\n", "\n", @@ -30,7 +39,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -52,14 +61,14 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "SynthesizabilityStatistics(num_cols=11, overall_att_count=208, possible_combinations=176947200, possible_combinations_per_row=59041.4, mean_vals_per_record=10.916583249916583, max_combinations_per_record=1932.9428262222075, excess_combinations_ratio=30.54482481274007)\n" + "SynthesizabilityStatistics(num_cols=11, overall_att_count=137, possible_combinations=51314688, possible_combinations_per_row=17122.0, mean_vals_per_record=10.912245578912245, max_combinations_per_record=1927.13988251201, excess_combinations_ratio=8.884669014104789)\n" ] } ], @@ -73,7 +82,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -95,19 +104,19 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - " selections protected_count\n", - "25355 record_count 3010\n", - "15237 description_issue:False 2277\n", - "3885 delivery_issue:False 2104\n", - "1731 service_issue:False 2067\n", - "21245 price_issue:False 2056\n" + " selections protected_count\n", + "51498 record_count 2992\n", + "41302 description_issue:False 2291\n", + "4980 description_issue:False;trueorfalse:0.0 2262\n", + "27228 trueorfalse:0.0 2262\n", + "4044 delivery_issue:False 2087\n" ] } ], @@ -118,7 +127,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -126,11 +135,11 @@ "output_type": "stream", "text": [ " Length Count +/- Error Suppressed % Fabricated %\n", - "0 1 147.06 +/- 8.50 9.99 % 0.00 %\n", - "1 2 20.97 +/- 7.61 21.00 % 0.50 %\n", - "2 3 6.66 +/- 6.60 34.40 % 2.30 %\n", - "3 4 3.23 +/- 5.26 51.55 % 1.84 %\n", - "4 Overall 4.46 +/- 5.79 41.84 % 1.73 %\n" + "0 1 238.72 +/- 7.87 2.16 % 0.00 %\n", + "1 2 41.76 +/- 7.55 6.21 % 0.35 %\n", + "2 3 12.96 +/- 6.63 14.94 % 2.15 %\n", + "3 4 5.72 +/- 5.30 33.49 % 2.50 %\n", + "4 Overall 7.83 +/- 5.75 24.68 % 2.04 %\n" ] } ], @@ -147,7 +156,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -155,11 +164,11 @@ "output_type": "stream", "text": [ " Length Count +/- Error Suppressed % Fabricated %\n", - "0 1 147.06 +/- 8.50 9.99 % 0.00 %\n", - "1 2 20.97 +/- 29.91 21.03 % 0.24 %\n", - "2 3 6.66 +/- 21.26 35.79 % 0.56 %\n", - "3 4 3.23 +/- 16.47 54.05 % 0.42 %\n", - "4 Overall 4.46 +/- 18.84 43.66 % 0.40 %\n" + "0 1 238.72 +/- 7.87 2.16 % 0.00 %\n", + "1 2 41.76 +/- 37.46 6.24 % 0.19 %\n", + "2 3 12.96 +/- 24.76 18.63 % 0.57 %\n", + "3 4 5.72 +/- 20.34 41.08 % 0.49 %\n", + "4 Overall 7.83 +/- 22.68 30.22 % 0.43 %\n" ] } ], @@ -176,9 +185,38 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 8, "metadata": {}, "outputs": [ + { + "data": { + "text/html": [ + " \n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data" + }, { "data": { "application/vnd.plotly.v1+json": { @@ -208,7 +246,33 @@ ], "xaxis": "x", "y": [ - 2277 + 2291 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "hovertemplate": "Attribute=trueorfalse
Attribute Value=%{x}
Count=%{y}", + "legendgroup": "trueorfalse", + "marker": { + "color": "#3283FE", + "pattern": { + "shape": "" + } + }, + "name": "trueorfalse", + "offsetgroup": "trueorfalse", + "orientation": "v", + "showlegend": true, + "textposition": "auto", + "texttemplate": "%{y}", + "type": "bar", + "x": [ + "trueorfalse:0.0" + ], + "xaxis": "x", + "y": [ + 2262 ], "yaxis": "y" }, @@ -217,7 +281,7 @@ "hovertemplate": "Attribute=delivery_issue
Attribute Value=%{x}
Count=%{y}", "legendgroup": "delivery_issue", "marker": { - "color": "#3283FE", + "color": "#85660D", "pattern": { "shape": "" } @@ -234,7 +298,7 @@ ], "xaxis": "x", "y": [ - 2104 + 2087 ], "yaxis": "y" }, @@ -243,7 +307,7 @@ "hovertemplate": "Attribute=service_issue
Attribute Value=%{x}
Count=%{y}", "legendgroup": "service_issue", "marker": { - "color": "#85660D", + "color": "#782AB6", "pattern": { "shape": "" } @@ -261,8 +325,8 @@ ], "xaxis": "x", "y": [ - 2067, - 947 + 2057, + 942 ], "yaxis": "y" }, @@ -271,7 +335,7 @@ "hovertemplate": "Attribute=price_issue
Attribute Value=%{x}
Count=%{y}", "legendgroup": "price_issue", "marker": { - "color": "#782AB6", + "color": "#565656", "pattern": { "shape": "" } @@ -288,7 +352,7 @@ ], "xaxis": "x", "y": [ - 2056 + 2050 ], "yaxis": "y" }, @@ -297,7 +361,7 @@ "hovertemplate": "Attribute=quality_issue
Attribute Value=%{x}
Count=%{y}", "legendgroup": "quality_issue", "marker": { - "color": "#565656", + "color": "#1C8356", "pattern": { "shape": "" } @@ -310,13 +374,11 @@ "texttemplate": "%{y}", "type": "bar", "x": [ - "quality_issue:False", - "quality_issue:True" + "quality_issue:False" ], "xaxis": "x", "y": [ - 2049, - 934 + 2035 ], "yaxis": "y" }, @@ -325,7 +387,7 @@ "hovertemplate": "Attribute=age_range
Attribute Value=%{x}
Count=%{y}", "legendgroup": "age_range", "marker": { - "color": "#1C8356", + "color": "#16FF32", "pattern": { "shape": "" } @@ -342,7 +404,7 @@ ], "xaxis": "x", "y": [ - 1296 + 1298 ], "yaxis": "y" }, @@ -351,7 +413,7 @@ "hovertemplate": "Attribute=period
Attribute Value=%{x}
Count=%{y}", "legendgroup": "period", "marker": { - "color": "#16FF32", + "color": "#F7E1A0", "pattern": { "shape": "" } @@ -369,8 +431,8 @@ ], "xaxis": "x", "y": [ - 1087, - 1065 + 1074, + 1059 ], "yaxis": "y" } @@ -1228,9 +1290,9 @@ } }, "text/html": [ - "
\n", - " " - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.plotly.v1+json": { - "config": { - "plotlyServerURL": "https://plot.ly" - }, - "data": [ - { - "alignmentgroup": "True", - "hovertemplate": "Attribute=description_issue
Attribute Value=%{x}
Count=%{y}", - "legendgroup": "description_issue", - "marker": { - "color": "#AA0DFE", - "pattern": { - "shape": "" - } - }, - "name": "description_issue", - "offsetgroup": "description_issue", - "orientation": "v", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{y}", - "type": "bar", - "x": [ - "description_issue:False" - ], - "xaxis": "x", - "y": [ - 2291 - ], - "yaxis": "y" - }, - { - "alignmentgroup": "True", - "hovertemplate": "Attribute=trueorfalse
Attribute Value=%{x}
Count=%{y}", - "legendgroup": "trueorfalse", - "marker": { - "color": "#3283FE", - "pattern": { - "shape": "" - } - }, - "name": "trueorfalse", - "offsetgroup": "trueorfalse", - "orientation": "v", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{y}", - "type": "bar", - "x": [ - "trueorfalse:0.0" - ], - "xaxis": "x", - "y": [ - 2262 - ], - "yaxis": "y" - }, - { - "alignmentgroup": "True", - "hovertemplate": "Attribute=delivery_issue
Attribute Value=%{x}
Count=%{y}", - "legendgroup": "delivery_issue", - "marker": { - "color": "#85660D", - "pattern": { - "shape": "" - } - }, - "name": "delivery_issue", - "offsetgroup": "delivery_issue", - "orientation": "v", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{y}", - "type": "bar", - "x": [ - "delivery_issue:False" - ], - "xaxis": "x", - "y": [ - 2087 - ], - "yaxis": "y" - }, - { - "alignmentgroup": "True", - "hovertemplate": "Attribute=service_issue
Attribute Value=%{x}
Count=%{y}", - "legendgroup": "service_issue", - "marker": { - "color": "#782AB6", - "pattern": { - "shape": "" - } - }, - "name": "service_issue", - "offsetgroup": "service_issue", - "orientation": "v", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{y}", - "type": "bar", - "x": [ - "service_issue:False", - "service_issue:True" - ], - "xaxis": "x", - "y": [ - 2057, - 942 - ], - "yaxis": "y" - }, - { - "alignmentgroup": "True", - "hovertemplate": "Attribute=price_issue
Attribute Value=%{x}
Count=%{y}", - "legendgroup": "price_issue", - "marker": { - "color": "#565656", - "pattern": { - "shape": "" - } - }, - "name": "price_issue", - "offsetgroup": "price_issue", - "orientation": "v", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{y}", - "type": "bar", - "x": [ - "price_issue:False" - ], - "xaxis": "x", - "y": [ - 2050 - ], - "yaxis": "y" - }, - { - "alignmentgroup": "True", - "hovertemplate": "Attribute=quality_issue
Attribute Value=%{x}
Count=%{y}", - "legendgroup": "quality_issue", - "marker": { - "color": "#1C8356", - "pattern": { - "shape": "" - } - }, - "name": "quality_issue", - "offsetgroup": "quality_issue", - "orientation": "v", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{y}", - "type": "bar", - "x": [ - "quality_issue:False" - ], - "xaxis": "x", - "y": [ - 2035 - ], - "yaxis": "y" - }, - { - "alignmentgroup": "True", - "hovertemplate": "Attribute=age_range
Attribute Value=%{x}
Count=%{y}", - "legendgroup": "age_range", - "marker": { - "color": "#16FF32", - "pattern": { - "shape": "" - } - }, - "name": "age_range", - "offsetgroup": "age_range", - "orientation": "v", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{y}", - "type": "bar", - "x": [ - "age_range:(30-40]" - ], - "xaxis": "x", - "y": [ - 1298 - ], - "yaxis": "y" - }, - { - "alignmentgroup": "True", - "hovertemplate": "Attribute=period
Attribute Value=%{x}
Count=%{y}", - "legendgroup": "period", - "marker": { - "color": "#F7E1A0", - "pattern": { - "shape": "" - } - }, - "name": "period", - "offsetgroup": "period", - "orientation": "v", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{y}", - "type": "bar", - "x": [ - "period:2023-H2", - "period:2023-H1" - ], - "xaxis": "x", - "y": [ - 1074, - 1059 - ], - "yaxis": "y" - } - ], - "layout": { - "barmode": "relative", - "height": 600, - "legend": { - "title": { - "text": "Attribute" - }, - "tracegroupgap": 0 - }, - "template": { - "data": { - "bar": [ - { - "error_x": { - "color": "#2a3f5f" - }, - "error_y": { - "color": "#2a3f5f" - }, - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "bar" - } - ], - "barpolar": [ - { - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "barpolar" - } - ], - "carpet": [ - { - "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "type": "carpet" - } - ], - "choropleth": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "choropleth" - } - ], - "contour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "contour" - } - ], - "contourcarpet": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "contourcarpet" - } - ], - "heatmap": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmap" - } - ], - "heatmapgl": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmapgl" - } - ], - "histogram": [ - { - "marker": { - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "histogram" - } - ], - "histogram2d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2d" - } - ], - "histogram2dcontour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2dcontour" - } - ], - "mesh3d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "mesh3d" - } - ], - "parcoords": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "parcoords" - } - ], - "pie": [ - { - "automargin": true, - "type": "pie" - } - ], - "scatter": [ - { - "fillpattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - }, - "type": "scatter" - } - ], - "scatter3d": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatter3d" - } - ], - "scattercarpet": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattercarpet" - } - ], - "scattergeo": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergeo" - } - ], - "scattergl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergl" - } - ], - "scattermapbox": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattermapbox" - } - ], - "scatterpolar": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolar" - } - ], - "scatterpolargl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolargl" - } - ], - "scatterternary": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterternary" - } - ], - "surface": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "surface" - } - ], - "table": [ - { - "cells": { - "fill": { - "color": "#EBF0F8" - }, - "line": { - "color": "white" - } - }, - "header": { - "fill": { - "color": "#C8D4E3" - }, - "line": { - "color": "white" - } - }, - "type": "table" - } - ] - }, - "layout": { - "annotationdefaults": { - "arrowcolor": "#2a3f5f", - "arrowhead": 0, - "arrowwidth": 1 - }, - "autotypenumbers": "strict", - "coloraxis": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "colorscale": { - "diverging": [ - [ - 0, - "#8e0152" - ], - [ - 0.1, - "#c51b7d" - ], - [ - 0.2, - "#de77ae" - ], - [ - 0.3, - "#f1b6da" - ], - [ - 0.4, - "#fde0ef" - ], - [ - 0.5, - "#f7f7f7" - ], - [ - 0.6, - "#e6f5d0" - ], - [ - 0.7, - "#b8e186" - ], - [ - 0.8, - "#7fbc41" - ], - [ - 0.9, - "#4d9221" - ], - [ - 1, - "#276419" - ] - ], - "sequential": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "sequentialminus": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ] - }, - "colorway": [ - "#636efa", - "#EF553B", - "#00cc96", - "#ab63fa", - "#FFA15A", - "#19d3f3", - "#FF6692", - "#B6E880", - "#FF97FF", - "#FECB52" - ], - "font": { - "color": "#2a3f5f" - }, - "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "#E5ECF6", - "showlakes": true, - "showland": true, - "subunitcolor": "white" - }, - "hoverlabel": { - "align": "left" - }, - "hovermode": "closest", - "mapbox": { - "style": "light" - }, - "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", - "polar": { - "angularaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "radialaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "scene": { - "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - } - }, - "shapedefaults": { - "line": { - "color": "#2a3f5f" - } - }, - "ternary": { - "aaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "baxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "caxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "title": { - "x": 0.05 - }, - "xaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - }, - "yaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - } - } - }, - "title": { - "text": "Top attributes across all Customer records" - }, - "width": 1000, - "xaxis": { - "anchor": "y", - "domain": [ - 0, - 1 - ], - "title": { - "text": "" - } - }, - "yaxis": { - "anchor": "x", - "categoryorder": "total descending", - "domain": [ - 0, - 1 - ], - "title": { - "text": "Customer Count" - } - } - } - }, - "text/html": [ - "
" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Create example top attributes bar chart\n", "bar_chart, bar_chart_df = acd.get_bar_chart_fig(\n", @@ -1337,1299 +122,9 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.plotly.v1+json": { - "config": { - "plotlyServerURL": "https://plot.ly" - }, - "data": [ - { - "hovertemplate": "Attribute Value=delivery_issue:False
period=%{x}
Count=%{y}", - "legendgroup": "delivery_issue:False", - "line": { - "color": "#AA0DFE", - "dash": "solid" - }, - "marker": { - "symbol": "circle" - }, - "mode": "lines", - "name": "delivery_issue:False", - "orientation": "v", - "showlegend": true, - "type": "scatter", - "x": [ - "2020-H1", - "2020-H2", - "2021-H1", - "2021-H2", - "2022-H1", - "2022-H2", - "2023-H1", - "2023-H2", - "2024-H1" - ], - "xaxis": "x", - "y": [ - 35, - 79, - 90, - 93, - 128, - 131, - 717, - 741, - 30 - ], - "yaxis": "y" - }, - { - "hovertemplate": "Attribute Value=delivery_issue:True
period=%{x}
Count=%{y}", - "legendgroup": "delivery_issue:True", - "line": { - "color": "#3283FE", - "dash": "solid" - }, - "marker": { - "symbol": "circle" - }, - "mode": "lines", - "name": "delivery_issue:True", - "orientation": "v", - "showlegend": true, - "type": "scatter", - "x": [ - "2020-H1", - "2020-H2", - "2021-H1", - "2021-H2", - "2022-H1", - "2022-H2", - "2023-H1", - "2023-H2", - "2024-H1" - ], - "xaxis": "x", - "y": [ - 18, - 14, - 14, - 40, - 17, - 81, - 332, - 355, - 6 - ], - "yaxis": "y" - }, - { - "hovertemplate": "Attribute Value=description_issue:False
period=%{x}
Count=%{y}", - "legendgroup": "description_issue:False", - "line": { - "color": "#85660D", - "dash": "solid" - }, - "marker": { - "symbol": "circle" - }, - "mode": "lines", - "name": "description_issue:False", - "orientation": "v", - "showlegend": true, - "type": "scatter", - "x": [ - "2020-H1", - "2020-H2", - "2021-H1", - "2021-H2", - "2022-H1", - "2022-H2", - "2023-H1", - "2023-H2", - "2024-H1" - ], - "xaxis": "x", - "y": [ - 33, - 95, - 89, - 128, - 124, - 164, - 778, - 832, - 33 - ], - "yaxis": "y" - }, - { - "hovertemplate": "Attribute Value=description_issue:True
period=%{x}
Count=%{y}", - "legendgroup": "description_issue:True", - "line": { - "color": "#782AB6", - "dash": "solid" - }, - "marker": { - "symbol": "circle" - }, - "mode": "lines", - "name": "description_issue:True", - "orientation": "v", - "showlegend": true, - "type": "scatter", - "x": [ - "2020-H1", - "2020-H2", - "2021-H1", - "2021-H2", - "2022-H1", - "2022-H2", - "2023-H1", - "2023-H2", - "2024-H1" - ], - "xaxis": "x", - "y": [ - 0, - 21, - 7, - 27, - 38, - 43, - 288, - 259, - 21 - ], - "yaxis": "y" - }, - { - "hovertemplate": "Attribute Value=price_issue:False
period=%{x}
Count=%{y}", - "legendgroup": "price_issue:False", - "line": { - "color": "#565656", - "dash": "solid" - }, - "marker": { - "symbol": "circle" - }, - "mode": "lines", - "name": "price_issue:False", - "orientation": "v", - "showlegend": true, - "type": "scatter", - "x": [ - "2020-H1", - "2020-H2", - "2021-H1", - "2021-H2", - "2022-H1", - "2022-H2", - "2023-H1", - "2023-H2", - "2024-H1" - ], - "xaxis": "x", - "y": [ - 27, - 79, - 63, - 122, - 92, - 141, - 686, - 749, - 36 - ], - "yaxis": "y" - }, - { - "hovertemplate": "Attribute Value=price_issue:True
period=%{x}
Count=%{y}", - "legendgroup": "price_issue:True", - "line": { - "color": "#1C8356", - "dash": "solid" - }, - "marker": { - "symbol": "circle" - }, - "mode": "lines", - "name": "price_issue:True", - "orientation": "v", - "showlegend": true, - "type": "scatter", - "x": [ - "2020-H1", - "2020-H2", - "2021-H1", - "2021-H2", - "2022-H1", - "2022-H2", - "2023-H1", - "2023-H2", - "2024-H1" - ], - "xaxis": "x", - "y": [ - 0, - 11, - 26, - 30, - 49, - 65, - 390, - 342, - 0 - ], - "yaxis": "y" - }, - { - "hovertemplate": "Attribute Value=quality_issue:False
period=%{x}
Count=%{y}", - "legendgroup": "quality_issue:False", - "line": { - "color": "#16FF32", - "dash": "solid" - }, - "marker": { - "symbol": "circle" - }, - "mode": "lines", - "name": "quality_issue:False", - "orientation": "v", - "showlegend": true, - "type": "scatter", - "x": [ - "2020-H1", - "2020-H2", - "2021-H1", - "2021-H2", - "2022-H1", - "2022-H2", - "2023-H1", - "2023-H2", - "2024-H1" - ], - "xaxis": "x", - "y": [ - 27, - 75, - 56, - 131, - 88, - 150, - 735, - 710, - 32 - ], - "yaxis": "y" - }, - { - "hovertemplate": "Attribute Value=quality_issue:True
period=%{x}
Count=%{y}", - "legendgroup": "quality_issue:True", - "line": { - "color": "#F7E1A0", - "dash": "solid" - }, - "marker": { - "symbol": "circle" - }, - "mode": "lines", - "name": "quality_issue:True", - "orientation": "v", - "showlegend": true, - "type": "scatter", - "x": [ - "2020-H1", - "2020-H2", - "2021-H1", - "2021-H2", - "2022-H1", - "2022-H2", - "2023-H1", - "2023-H2", - "2024-H1" - ], - "xaxis": "x", - "y": [ - 10, - 41, - 38, - 17, - 64, - 77, - 341, - 361, - 12 - ], - "yaxis": "y" - }, - { - "hovertemplate": "Attribute Value=service_issue:False
period=%{x}
Count=%{y}", - "legendgroup": "service_issue:False", - "line": { - "color": "#E2E2E2", - "dash": "solid" - }, - "marker": { - "symbol": "circle" - }, - "mode": "lines", - "name": "service_issue:False", - "orientation": "v", - "showlegend": true, - "type": "scatter", - "x": [ - "2020-H1", - "2020-H2", - "2021-H1", - "2021-H2", - "2022-H1", - "2022-H2", - "2023-H1", - "2023-H2", - "2024-H1" - ], - "xaxis": "x", - "y": [ - 30, - 68, - 80, - 66, - 124, - 183, - 766, - 719, - 15 - ], - "yaxis": "y" - }, - { - "hovertemplate": "Attribute Value=service_issue:True
period=%{x}
Count=%{y}", - "legendgroup": "service_issue:True", - "line": { - "color": "#1CBE4F", - "dash": "solid" - }, - "marker": { - "symbol": "circle" - }, - "mode": "lines", - "name": "service_issue:True", - "orientation": "v", - "showlegend": true, - "type": "scatter", - "x": [ - "2020-H1", - "2020-H2", - "2021-H1", - "2021-H2", - "2022-H1", - "2022-H2", - "2023-H1", - "2023-H2", - "2024-H1" - ], - "xaxis": "x", - "y": [ - 30, - 50, - 31, - 73, - 41, - 41, - 311, - 353, - 25 - ], - "yaxis": "y" - } - ], - "layout": { - "height": 600, - "legend": { - "title": { - "text": "Attribute Value" - }, - "tracegroupgap": 0 - }, - "template": { - "data": { - "bar": [ - { - "error_x": { - "color": "#2a3f5f" - }, - "error_y": { - "color": "#2a3f5f" - }, - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "bar" - } - ], - "barpolar": [ - { - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "barpolar" - } - ], - "carpet": [ - { - "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "type": "carpet" - } - ], - "choropleth": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "choropleth" - } - ], - "contour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "contour" - } - ], - "contourcarpet": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "contourcarpet" - } - ], - "heatmap": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmap" - } - ], - "heatmapgl": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmapgl" - } - ], - "histogram": [ - { - "marker": { - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "histogram" - } - ], - "histogram2d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2d" - } - ], - "histogram2dcontour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2dcontour" - } - ], - "mesh3d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "mesh3d" - } - ], - "parcoords": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "parcoords" - } - ], - "pie": [ - { - "automargin": true, - "type": "pie" - } - ], - "scatter": [ - { - "fillpattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - }, - "type": "scatter" - } - ], - "scatter3d": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatter3d" - } - ], - "scattercarpet": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattercarpet" - } - ], - "scattergeo": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergeo" - } - ], - "scattergl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergl" - } - ], - "scattermapbox": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattermapbox" - } - ], - "scatterpolar": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolar" - } - ], - "scatterpolargl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolargl" - } - ], - "scatterternary": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterternary" - } - ], - "surface": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "surface" - } - ], - "table": [ - { - "cells": { - "fill": { - "color": "#EBF0F8" - }, - "line": { - "color": "white" - } - }, - "header": { - "fill": { - "color": "#C8D4E3" - }, - "line": { - "color": "white" - } - }, - "type": "table" - } - ] - }, - "layout": { - "annotationdefaults": { - "arrowcolor": "#2a3f5f", - "arrowhead": 0, - "arrowwidth": 1 - }, - "autotypenumbers": "strict", - "coloraxis": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "colorscale": { - "diverging": [ - [ - 0, - "#8e0152" - ], - [ - 0.1, - "#c51b7d" - ], - [ - 0.2, - "#de77ae" - ], - [ - 0.3, - "#f1b6da" - ], - [ - 0.4, - "#fde0ef" - ], - [ - 0.5, - "#f7f7f7" - ], - [ - 0.6, - "#e6f5d0" - ], - [ - 0.7, - "#b8e186" - ], - [ - 0.8, - "#7fbc41" - ], - [ - 0.9, - "#4d9221" - ], - [ - 1, - "#276419" - ] - ], - "sequential": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "sequentialminus": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ] - }, - "colorway": [ - "#636efa", - "#EF553B", - "#00cc96", - "#ab63fa", - "#FFA15A", - "#19d3f3", - "#FF6692", - "#B6E880", - "#FF97FF", - "#FECB52" - ], - "font": { - "color": "#2a3f5f" - }, - "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "#E5ECF6", - "showlakes": true, - "showland": true, - "subunitcolor": "white" - }, - "hoverlabel": { - "align": "left" - }, - "hovermode": "closest", - "mapbox": { - "style": "light" - }, - "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", - "polar": { - "angularaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "radialaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "scene": { - "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - } - }, - "shapedefaults": { - "line": { - "color": "#2a3f5f" - } - }, - "ternary": { - "aaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "baxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "caxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "title": { - "x": 0.05 - }, - "xaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - }, - "yaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - } - } - }, - "title": { - "text": "Time series across all Customer records" - }, - "width": 1000, - "xaxis": { - "anchor": "y", - "domain": [ - 0, - 1 - ], - "title": { - "text": "period" - } - }, - "yaxis": { - "anchor": "x", - "domain": [ - 0, - 1 - ], - "title": { - "text": "Customer Count" - } - } - } - }, - "text/html": [ - "
" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Create example time series line chart\n", "line_chart, line_chart_df = acd.get_line_chart_fig(\n", @@ -2652,1615 +147,9 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.plotly.v1+json": { - "config": { - "plotlyServerURL": "https://plot.ly" - }, - "data": [ - { - "link": { - "color": [ - "#b4acb8", - "#b4aaba", - "#c083e1", - "#b2b2b2", - "#b6a5bf", - "#b3afb5", - "#b2b2b2", - "#b4aaba", - "#b6a5bf", - "#b3adb7", - "#c180e4", - "#be89db", - "#b6a5bf", - "#b2b2b2", - "#ba99cb", - "#b5aaba", - "#c180e4", - "#b4acb8", - "#b7a0c4", - "#bb95cf", - "#b5a7bd", - "#b5a9bb", - "#b2b2b2", - "#b3b0b4", - "#b2b2b2", - "#b2b2b2", - "#b7a3c1", - "#bc91d3", - "#bc90d4", - "#bf88dc", - "#b4adb7", - "#b4aaba", - "#b2b2b2", - "#c671f3", - "#b5a7bd", - "#c181e3", - "#b5a9bb", - "#c37aea", - "#be89db", - "#b2b2b2", - "#b99aca", - "#bc90d4", - "#bb95cf", - "#b2b2b2", - "#b99bc9", - "#b7a2c2", - "#b2b2b2", - "#bb95cf", - "#c083e1", - "#b3aeb6", - "#c965ff", - "#c379eb", - "#b2b2b2", - "#b2b2b2", - "#c965ff", - "#bb93d1", - "#c965ff", - "#c475ef", - "#c965ff", - "#b5a7bd", - "#b2b2b2", - "#c083e1", - "#c27de7", - "#b2b2b2", - "#b2b2b2", - "#b2b2b2", - "#c180e4", - "#b2b2b2", - "#b89dc7", - "#b2b2b2", - "#c965ff", - "#b2b2b2", - "#b2b2b2", - "#b2b2b2", - "#b2b2b2", - "#c76df7", - "#c965ff", - "#b2b2b2", - "#b2b2b2", - "#c965ff", - "#c965ff", - "#bc92d2", - "#c965ff", - "#c965ff", - "#c965ff", - "#b6a6be" - ], - "customdata": [ - [ - 10, - 0.08403361344537816 - ], - [ - 11, - 0.10091743119266056 - ], - [ - 63, - 0.6237623762376238 - ], - [ - 0, - 0 - ], - [ - 11, - 0.1746031746031746 - ], - [ - 3, - 0.04838709677419355 - ], - [ - 0, - 0 - ], - [ - 6, - 0.10909090909090909 - ], - [ - 9, - 0.17647058823529413 - ], - [ - 3, - 0.061224489795918366 - ], - [ - 32, - 0.6530612244897959 - ], - [ - 22, - 0.5365853658536586 - ], - [ - 7, - 0.175 - ], - [ - 0, - 0 - ], - [ - 13, - 0.3333333333333333 - ], - [ - 4, - 0.1111111111111111 - ], - [ - 23, - 0.6571428571428571 - ], - [ - 3, - 0.08571428571428572 - ], - [ - 8, - 0.23529411764705882 - ], - [ - 13, - 0.38235294117647056 - ], - [ - 5, - 0.15151515151515152 - ], - [ - 4, - 0.12121212121212122 - ], - [ - 0, - 0 - ], - [ - 1, - 0.030303030303030304 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 6, - 0.2 - ], - [ - 13, - 0.43333333333333335 - ], - [ - 13, - 0.4482758620689655 - ], - [ - 16, - 0.5517241379310345 - ], - [ - 2, - 0.07142857142857142 - ], - [ - 3, - 0.10714285714285714 - ], - [ - 0, - 0 - ], - [ - 23, - 0.8518518518518519 - ], - [ - 4, - 0.15384615384615385 - ], - [ - 16, - 0.64 - ], - [ - 3, - 0.125 - ], - [ - 17, - 0.7391304347826086 - ], - [ - 12, - 0.5454545454545454 - ], - [ - 0, - 0 - ], - [ - 7, - 0.3181818181818182 - ], - [ - 10, - 0.45454545454545453 - ], - [ - 8, - 0.38095238095238093 - ], - [ - 0, - 0 - ], - [ - 6, - 0.3 - ], - [ - 4, - 0.21052631578947367 - ], - [ - 0, - 0 - ], - [ - 7, - 0.3888888888888889 - ], - [ - 11, - 0.6111111111111112 - ], - [ - 1, - 0.05555555555555555 - ], - [ - 17, - 1 - ], - [ - 12, - 0.75 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 16, - 1 - ], - [ - 6, - 0.4 - ], - [ - 15, - 1 - ], - [ - 12, - 0.8 - ], - [ - 14, - 1 - ], - [ - 2, - 0.15384615384615385 - ], - [ - 0, - 0 - ], - [ - 8, - 0.6153846153846154 - ], - [ - 9, - 0.6923076923076923 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 8, - 0.6666666666666666 - ], - [ - 0, - 0 - ], - [ - 3, - 0.2727272727272727 - ], - [ - 0, - 0 - ], - [ - 11, - 1 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 9, - 0.9 - ], - [ - 8, - 1 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 7, - 1 - ], - [ - 7, - 1 - ], - [ - 3, - 0.42857142857142855 - ], - [ - 7, - 1 - ], - [ - 6, - 1 - ], - [ - 6, - 1 - ], - [ - 1, - 0.16666666666666666 - ] - ], - "hovertemplate": "city: %{source.label} + product_code: %{target.label} = %{value:.0f}
+ price_issue:True = %{customdata[0]}
Proportion = %{customdata[1]:.1%}", - "source": [ - 14, - 12, - 21, - 19, - 21, - 14, - 12, - 10, - 14, - 17, - 18, - 19, - 19, - 21, - 12, - 20, - 2, - 20, - 13, - 18, - 14, - 4, - 14, - 19, - 14, - 16, - 14, - 20, - 18, - 14, - 16, - 13, - 22, - 18, - 23, - 2, - 12, - 20, - 8, - 2, - 10, - 2, - 23, - 18, - 18, - 8, - 21, - 19, - 12, - 15, - 20, - 17, - 17, - 12, - 2, - 13, - 18, - 17, - 16, - 17, - 21, - 20, - 15, - 2, - 13, - 4, - 13, - 22, - 4, - 10, - 17, - 12, - 15, - 20, - 21, - 13, - 22, - 4, - 22, - 10, - 4, - 19, - 15, - 15, - 17, - 22 - ], - "target": [ - 3, - 5, - 0, - 1, - 9, - 5, - 9, - 6, - 1, - 3, - 0, - 0, - 9, - 3, - 11, - 0, - 9, - 1, - 5, - 11, - 6, - 3, - 11, - 7, - 7, - 6, - 9, - 6, - 9, - 0, - 9, - 0, - 9, - 1, - 7, - 5, - 6, - 9, - 3, - 1, - 11, - 7, - 6, - 3, - 6, - 11, - 1, - 11, - 3, - 7, - 3, - 1, - 5, - 1, - 11, - 11, - 7, - 0, - 11, - 6, - 6, - 7, - 11, - 0, - 3, - 5, - 9, - 3, - 7, - 9, - 7, - 0, - 1, - 11, - 11, - 6, - 5, - 6, - 0, - 7, - 9, - 5, - 9, - 0, - 11, - 1 - ], - "value": [ - 119, - 109, - 101, - 90, - 63, - 62, - 57, - 55, - 51, - 49, - 49, - 41, - 40, - 40, - 39, - 36, - 35, - 35, - 34, - 34, - 33, - 33, - 33, - 33, - 32, - 31, - 30, - 30, - 29, - 29, - 28, - 28, - 28, - 27, - 26, - 25, - 24, - 23, - 22, - 22, - 22, - 22, - 21, - 20, - 20, - 19, - 18, - 18, - 18, - 18, - 17, - 16, - 16, - 16, - 16, - 15, - 15, - 15, - 14, - 13, - 13, - 13, - 13, - 13, - 12, - 12, - 12, - 12, - 11, - 11, - 11, - 11, - 10, - 10, - 10, - 10, - 8, - 7, - 7, - 7, - 7, - 7, - 7, - 6, - 6, - 6 - ] - }, - "node": { - "color": "#AA0DFE", - "label": [ - "A ", - "B ", - "Brookside", - "C ", - "Clifftown", - "D ", - "E ", - "F ", - "Forestville", - "G ", - "Greenfield", - "H ", - "Hilltop", - "Hilltown", - "Lakeside", - "Meadowland", - "Meadowville", - "Mountainview", - "Riverside", - "Rivertown", - "Seaside", - "Springfield", - "Valleytown", - "Valleyview" - ], - "line": { - "color": "black", - "width": 0.5 - }, - "pad": 15, - "thickness": 20 - }, - "type": "sankey" - } - ], - "layout": { - "font": { - "size": 14 - }, - "height": 600, - "template": { - "data": { - "bar": [ - { - "error_x": { - "color": "#2a3f5f" - }, - "error_y": { - "color": "#2a3f5f" - }, - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "bar" - } - ], - "barpolar": [ - { - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "barpolar" - } - ], - "carpet": [ - { - "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "type": "carpet" - } - ], - "choropleth": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "choropleth" - } - ], - "contour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "contour" - } - ], - "contourcarpet": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "contourcarpet" - } - ], - "heatmap": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmap" - } - ], - "heatmapgl": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmapgl" - } - ], - "histogram": [ - { - "marker": { - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "histogram" - } - ], - "histogram2d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2d" - } - ], - "histogram2dcontour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2dcontour" - } - ], - "mesh3d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "mesh3d" - } - ], - "parcoords": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "parcoords" - } - ], - "pie": [ - { - "automargin": true, - "type": "pie" - } - ], - "scatter": [ - { - "fillpattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - }, - "type": "scatter" - } - ], - "scatter3d": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatter3d" - } - ], - "scattercarpet": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattercarpet" - } - ], - "scattergeo": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergeo" - } - ], - "scattergl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergl" - } - ], - "scattermapbox": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattermapbox" - } - ], - "scatterpolar": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolar" - } - ], - "scatterpolargl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolargl" - } - ], - "scatterternary": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterternary" - } - ], - "surface": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "surface" - } - ], - "table": [ - { - "cells": { - "fill": { - "color": "#EBF0F8" - }, - "line": { - "color": "white" - } - }, - "header": { - "fill": { - "color": "#C8D4E3" - }, - "line": { - "color": "white" - } - }, - "type": "table" - } - ] - }, - "layout": { - "annotationdefaults": { - "arrowcolor": "#2a3f5f", - "arrowhead": 0, - "arrowwidth": 1 - }, - "autotypenumbers": "strict", - "coloraxis": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "colorscale": { - "diverging": [ - [ - 0, - "#8e0152" - ], - [ - 0.1, - "#c51b7d" - ], - [ - 0.2, - "#de77ae" - ], - [ - 0.3, - "#f1b6da" - ], - [ - 0.4, - "#fde0ef" - ], - [ - 0.5, - "#f7f7f7" - ], - [ - 0.6, - "#e6f5d0" - ], - [ - 0.7, - "#b8e186" - ], - [ - 0.8, - "#7fbc41" - ], - [ - 0.9, - "#4d9221" - ], - [ - 1, - "#276419" - ] - ], - "sequential": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "sequentialminus": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ] - }, - "colorway": [ - "#636efa", - "#EF553B", - "#00cc96", - "#ab63fa", - "#FFA15A", - "#19d3f3", - "#FF6692", - "#B6E880", - "#FF97FF", - "#FECB52" - ], - "font": { - "color": "#2a3f5f" - }, - "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "#E5ECF6", - "showlakes": true, - "showland": true, - "subunitcolor": "white" - }, - "hoverlabel": { - "align": "left" - }, - "hovermode": "closest", - "mapbox": { - "style": "light" - }, - "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", - "polar": { - "angularaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "radialaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "scene": { - "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - } - }, - "shapedefaults": { - "line": { - "color": "#2a3f5f" - } - }, - "ternary": { - "aaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "baxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "caxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "title": { - "x": 0.05 - }, - "xaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - }, - "yaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - } - } - }, - "title": { - "text": "city—product_code links for all Customer records,
colored by proportion with price_issue:True" - }, - "width": 1000 - } - }, - "text/html": [ - "
" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Create example alluvial/flow chart of city-product relationships\n", "flow_chart, flow_chart_df = acd.get_flow_chart_fig(\n", diff --git a/toolkit/helpers/df_functions.py b/toolkit/helpers/df_functions.py index 7928ee98..9855a289 100644 --- a/toolkit/helpers/df_functions.py +++ b/toolkit/helpers/df_functions.py @@ -30,3 +30,23 @@ def fix_null_ints(in_df: pd.DataFrame) -> pd.DataFrame: def get_current_time() -> str: return pd.Timestamp.now().strftime("%Y%m%d%H%M%S") + +def supress_boolean_binary( + input_df: pd.DataFrame, output_df: pd.DataFrame | None = None +) -> pd.DataFrame: + if output_df is None: + output_df = input_df.copy() + for col in input_df.columns: + unique_values = [str(x) for x in input_df[col].unique()] + is_three_with_none = len(unique_values) == 3 and input_df[col].isna().any() + if len(unique_values) <= 2 or is_three_with_none: + if "0" in unique_values or "0.0" in unique_values: + output_df[col] = ( + input_df[col] + .astype(str) + .replace("0", np.nan) + .replace("0.0", np.nan) + ) + elif "False" in unique_values: + output_df[col] = input_df[col].astype(str).replace("False", np.nan) + return output_df \ No newline at end of file From cb309f59f97d3528c0d3dde83859e614c1d207fd Mon Sep 17 00:00:00 2001 From: Dayenne Souza Date: Wed, 30 Oct 2024 14:11:13 -0300 Subject: [PATCH 5/6] push notebook results --- example_notebooks/anonymize_case_data.ipynb | 4050 ++++++++++++++++++- 1 file changed, 4032 insertions(+), 18 deletions(-) diff --git a/example_notebooks/anonymize_case_data.ipynb b/example_notebooks/anonymize_case_data.ipynb index 66af96dd..f1777781 100644 --- a/example_notebooks/anonymize_case_data.ipynb +++ b/example_notebooks/anonymize_case_data.ipynb @@ -13,9 +13,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/ddesouza/Projects/intelligence-toolkit/.venv/lib/python3.11/site-packages/sentence_transformers/cross_encoder/CrossEncoder.py:13: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", + " from tqdm.autonotebook import tqdm, trange\n" + ] + } + ], "source": [ "import sys\n", "\n", @@ -30,9 +39,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Loaded data\n" + ] + } + ], "source": [ "# Create the workflow object\n", "\n", @@ -50,9 +67,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "SynthesizabilityStatistics(num_cols=9, overall_att_count=101, possible_combinations=27648, possible_combinations_per_row=9.2, mean_vals_per_record=5.409, max_combinations_per_record=42.488485068238006, excess_combinations_ratio=0.21652925457861052)\n" + ] + } + ], "source": [ "# Check the synthesizabiluty of the data\n", "synthesizability_stats: SynthesizabilityStatistics = acd.analyze_synthesizability(\n", @@ -63,9 +88,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Anonymized data\n" + ] + } + ], "source": [ "# Anonymize the data\n", "acd.anonymize_case_data(\n", @@ -77,9 +110,78 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
selectionsprotected_count
6431record_count3007
6357age_range:(30-40]1303
1519period:2023-H11076
3747period:2023-H21076
2812service_issue:True954
\n", + "
" + ], + "text/plain": [ + " selections protected_count\n", + "6431 record_count 3007\n", + "6357 age_range:(30-40] 1303\n", + "1519 period:2023-H1 1076\n", + "3747 period:2023-H2 1076\n", + "2812 service_issue:True 954" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Inspect the anonymous aggregate data\n", "acd.aggregate_df.head()" @@ -87,9 +189,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Length Count +/- Error Suppressed % Fabricated %\n", + "0 1 160.66 +/- 6.45 4.68 % 0.00 %\n", + "1 2 23.85 +/- 5.18 9.85 % 0.10 %\n", + "2 3 6.85 +/- 4.63 19.43 % 3.45 %\n", + "3 4 2.85 +/- 2.87 42.14 % 7.54 %\n", + "4 Overall 6.88 +/- 3.84 20.04 % 2.71 %\n" + ] + } + ], "source": [ "# Inspect the error report for the aggregate data\n", "# Length represents the length of the attribute value combination being counted\n", @@ -103,9 +218,1118 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + " \n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "hovertemplate": "Attribute=age_range
Attribute Value=%{x}
Count=%{y}", + "legendgroup": "age_range", + "marker": { + "color": "#AA0DFE", + "pattern": { + "shape": "" + } + }, + "name": "age_range", + "offsetgroup": "age_range", + "orientation": "v", + "showlegend": true, + "textposition": "auto", + "texttemplate": "%{y}", + "type": "bar", + "x": [ + "age_range:(30-40]", + "age_range:(20-30]", + "age_range:(40-50]" + ], + "xaxis": "x", + "y": [ + 1303, + 780, + 749 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "hovertemplate": "Attribute=period
Attribute Value=%{x}
Count=%{y}", + "legendgroup": "period", + "marker": { + "color": "#3283FE", + "pattern": { + "shape": "" + } + }, + "name": "period", + "offsetgroup": "period", + "orientation": "v", + "showlegend": true, + "textposition": "auto", + "texttemplate": "%{y}", + "type": "bar", + "x": [ + "period:2023-H2", + "period:2023-H1" + ], + "xaxis": "x", + "y": [ + 1076, + 1076 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "hovertemplate": "Attribute=service_issue
Attribute Value=%{x}
Count=%{y}", + "legendgroup": "service_issue", + "marker": { + "color": "#85660D", + "pattern": { + "shape": "" + } + }, + "name": "service_issue", + "offsetgroup": "service_issue", + "orientation": "v", + "showlegend": true, + "textposition": "auto", + "texttemplate": "%{y}", + "type": "bar", + "x": [ + "service_issue:True" + ], + "xaxis": "x", + "y": [ + 954 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "hovertemplate": "Attribute=quality_issue
Attribute Value=%{x}
Count=%{y}", + "legendgroup": "quality_issue", + "marker": { + "color": "#782AB6", + "pattern": { + "shape": "" + } + }, + "name": "quality_issue", + "offsetgroup": "quality_issue", + "orientation": "v", + "showlegend": true, + "textposition": "auto", + "texttemplate": "%{y}", + "type": "bar", + "x": [ + "quality_issue:True" + ], + "xaxis": "x", + "y": [ + 944 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "hovertemplate": "Attribute=price_issue
Attribute Value=%{x}
Count=%{y}", + "legendgroup": "price_issue", + "marker": { + "color": "#565656", + "pattern": { + "shape": "" + } + }, + "name": "price_issue", + "offsetgroup": "price_issue", + "orientation": "v", + "showlegend": true, + "textposition": "auto", + "texttemplate": "%{y}", + "type": "bar", + "x": [ + "price_issue:True" + ], + "xaxis": "x", + "y": [ + 936 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "hovertemplate": "Attribute=delivery_issue
Attribute Value=%{x}
Count=%{y}", + "legendgroup": "delivery_issue", + "marker": { + "color": "#1C8356", + "pattern": { + "shape": "" + } + }, + "name": "delivery_issue", + "offsetgroup": "delivery_issue", + "orientation": "v", + "showlegend": true, + "textposition": "auto", + "texttemplate": "%{y}", + "type": "bar", + "x": [ + "delivery_issue:True" + ], + "xaxis": "x", + "y": [ + 920 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "hovertemplate": "Attribute=description_issue
Attribute Value=%{x}
Count=%{y}", + "legendgroup": "description_issue", + "marker": { + "color": "#16FF32", + "pattern": { + "shape": "" + } + }, + "name": "description_issue", + "offsetgroup": "description_issue", + "orientation": "v", + "showlegend": true, + "textposition": "auto", + "texttemplate": "%{y}", + "type": "bar", + "x": [ + "description_issue:True" + ], + "xaxis": "x", + "y": [ + 725 + ], + "yaxis": "y" + } + ], + "layout": { + "barmode": "relative", + "height": 600, + "legend": { + "title": { + "text": "Attribute" + }, + "tracegroupgap": 0 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Top attributes across all Customer records" + }, + "width": 1000, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "" + } + }, + "yaxis": { + "anchor": "x", + "categoryorder": "total descending", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Customer Count" + } + } + } + }, + "text/html": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "# Create example top attributes bar chart\n", "bar_chart, bar_chart_df = acd.get_bar_chart_fig(\n", @@ -122,9 +1346,1099 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "hovertemplate": "Attribute Value=delivery_issue:True
period=%{x}
Count=%{y}", + "legendgroup": "delivery_issue:True", + "line": { + "color": "#AA0DFE", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "delivery_issue:True", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + "2020-H1", + "2020-H2", + "2021-H1", + "2021-H2", + "2022-H1", + "2022-H2", + "2023-H1", + "2023-H2", + "2024-H1" + ], + "xaxis": "x", + "y": [ + 7, + 20, + 19, + 40, + 14, + 77, + 328, + 356, + 17 + ], + "yaxis": "y" + }, + { + "hovertemplate": "Attribute Value=description_issue:True
period=%{x}
Count=%{y}", + "legendgroup": "description_issue:True", + "line": { + "color": "#3283FE", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "description_issue:True", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + "2020-H1", + "2020-H2", + "2021-H1", + "2021-H2", + "2022-H1", + "2022-H2", + "2023-H1", + "2023-H2", + "2024-H1" + ], + "xaxis": "x", + "y": [ + 24, + 23, + 14, + 23, + 37, + 42, + 291, + 263, + 6 + ], + "yaxis": "y" + }, + { + "hovertemplate": "Attribute Value=price_issue:True
period=%{x}
Count=%{y}", + "legendgroup": "price_issue:True", + "line": { + "color": "#85660D", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "price_issue:True", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + "2020-H1", + "2020-H2", + "2021-H1", + "2021-H2", + "2022-H1", + "2022-H2", + "2023-H1", + "2023-H2", + "2024-H1" + ], + "xaxis": "x", + "y": [ + 15, + 13, + 31, + 27, + 64, + 55, + 391, + 329, + 4 + ], + "yaxis": "y" + }, + { + "hovertemplate": "Attribute Value=quality_issue:True
period=%{x}
Count=%{y}", + "legendgroup": "quality_issue:True", + "line": { + "color": "#782AB6", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "quality_issue:True", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + "2020-H1", + "2020-H2", + "2021-H1", + "2021-H2", + "2022-H1", + "2022-H2", + "2023-H1", + "2023-H2", + "2024-H1" + ], + "xaxis": "x", + "y": [ + 16, + 44, + 26, + 21, + 60, + 65, + 345, + 365, + 4 + ], + "yaxis": "y" + }, + { + "hovertemplate": "Attribute Value=service_issue:True
period=%{x}
Count=%{y}", + "legendgroup": "service_issue:True", + "line": { + "color": "#565656", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "service_issue:True", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + "2020-H1", + "2020-H2", + "2021-H1", + "2021-H2", + "2022-H1", + "2022-H2", + "2023-H1", + "2023-H2", + "2024-H1" + ], + "xaxis": "x", + "y": [ + 13, + 54, + 33, + 68, + 47, + 34, + 325, + 359, + 26 + ], + "yaxis": "y" + } + ], + "layout": { + "height": 600, + "legend": { + "title": { + "text": "Attribute Value" + }, + "tracegroupgap": 0 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Time series across all Customer records" + }, + "width": 1000, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "period" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Customer Count" + } + } + } + }, + "text/html": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "# Create example time series line chart\n", "line_chart, line_chart_df = acd.get_line_chart_fig(\n", @@ -147,9 +2461,1709 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "link": { + "color": [ + "#b3aeb6", + "#be89db", + "#b5a7bd", + "#b6a3c1", + "#b3aeb6", + "#b5a8bc", + "#b6a5bf", + "#b7a0c4", + "#bd8fd5", + "#b6a6be", + "#c083e1", + "#c180e4", + "#bc91d3", + "#b99bc9", + "#b5a9bb", + "#b2b0b4", + "#b2b2b2", + "#b2b2b2", + "#b4abb9", + "#b2b2b2", + "#bd8dd7", + "#b4abb9", + "#b99bc9", + "#bd8cd8", + "#ba96ce", + "#ba96ce", + "#c180e4", + "#c085df", + "#b7a0c4", + "#b2b2b2", + "#b7a3c1", + "#bc90d4", + "#b2b2b2", + "#b89dc7", + "#b7a0c4", + "#bd8ed6", + "#bd8ed6", + "#b5a7bd", + "#c671f3", + "#b2b2b2", + "#bb93d1", + "#c27ee6", + "#b2b2b2", + "#c965ff", + "#bd8cd8", + "#b2b2b2", + "#b2b2b2", + "#bd8cd8", + "#b2b2b2", + "#b5a9bb", + "#b99aca", + "#b2b2b2", + "#b5a9bb", + "#b2b2b2", + "#b5a8bc", + "#c084e0", + "#c181e3", + "#b5a7bd", + "#b4adb7", + "#b5a7bd", + "#c76cf8", + "#bd8cd8", + "#b2b2b2", + "#c965ff", + "#bc90d4", + "#b2b2b2", + "#c965ff", + "#c76df7", + "#b2b2b2", + "#b2b2b2", + "#c475ef", + "#b2b2b2", + "#ba99cb", + "#bf88dc", + "#c965ff", + "#b5aaba", + "#c965ff", + "#c965ff", + "#ba96ce", + "#ba96ce", + "#c965ff", + "#b2b2b2", + "#b2b2b2", + "#c965ff", + "#c965ff", + "#b2b2b2", + "#bf86de", + "#b2b2b2", + "#c965ff", + "#c965ff", + "#b2b2b2", + "#c084e0", + "#c965ff", + "#b2b2b2", + "#b2b2b2", + "#b2b2b2", + "#b2b2b2", + "#b2b2b2" + ], + "customdata": [ + [ + 6, + 0.05454545454545454 + ], + [ + 57, + 0.5428571428571428 + ], + [ + 15, + 0.1485148514851485 + ], + [ + 16, + 0.19753086419753085 + ], + [ + 4, + 0.056338028169014086 + ], + [ + 8, + 0.13114754098360656 + ], + [ + 10, + 0.1724137931034483 + ], + [ + 13, + 0.23636363636363636 + ], + [ + 23, + 0.46938775510204084 + ], + [ + 8, + 0.16666666666666666 + ], + [ + 29, + 0.6170212765957447 + ], + [ + 29, + 0.6590909090909091 + ], + [ + 19, + 0.4318181818181818 + ], + [ + 12, + 0.3 + ], + [ + 5, + 0.125 + ], + [ + 1, + 0.029411764705882353 + ], + [ + 0, + 0 + ], + [ + 0, + 0 + ], + [ + 3, + 0.09375 + ], + [ + 0, + 0 + ], + [ + 15, + 0.4838709677419355 + ], + [ + 3, + 0.0967741935483871 + ], + [ + 9, + 0.3 + ], + [ + 15, + 0.5 + ], + [ + 11, + 0.36666666666666664 + ], + [ + 11, + 0.3793103448275862 + ], + [ + 19, + 0.6551724137931034 + ], + [ + 16, + 0.5925925925925926 + ], + [ + 6, + 0.23076923076923078 + ], + [ + 0, + 0 + ], + [ + 5, + 0.2 + ], + [ + 11, + 0.4583333333333333 + ], + [ + 0, + 0 + ], + [ + 6, + 0.2727272727272727 + ], + [ + 5, + 0.23809523809523808 + ], + [ + 10, + 0.47619047619047616 + ], + [ + 10, + 0.47619047619047616 + ], + [ + 3, + 0.14285714285714285 + ], + [ + 17, + 0.85 + ], + [ + 0, + 0 + ], + [ + 8, + 0.4 + ], + [ + 13, + 0.6842105263157895 + ], + [ + 0, + 0 + ], + [ + 18, + 1 + ], + [ + 9, + 0.5 + ], + [ + 0, + 0 + ], + [ + 0, + 0 + ], + [ + 9, + 0.5 + ], + [ + 0, + 0 + ], + [ + 2, + 0.125 + ], + [ + 5, + 0.3125 + ], + [ + 0, + 0 + ], + [ + 2, + 0.125 + ], + [ + 0, + 0 + ], + [ + 2, + 0.13333333333333333 + ], + [ + 9, + 0.6 + ], + [ + 9, + 0.6428571428571429 + ], + [ + 2, + 0.15384615384615385 + ], + [ + 1, + 0.07692307692307693 + ], + [ + 2, + 0.15384615384615385 + ], + [ + 12, + 0.9230769230769231 + ], + [ + 6, + 0.5 + ], + [ + 0, + 0 + ], + [ + 11, + 1 + ], + [ + 5, + 0.45454545454545453 + ], + [ + 0, + 0 + ], + [ + 11, + 1 + ], + [ + 10, + 0.9090909090909091 + ], + [ + 0, + 0 + ], + [ + 0, + 0 + ], + [ + 8, + 0.8 + ], + [ + 0, + 0 + ], + [ + 3, + 0.3333333333333333 + ], + [ + 5, + 0.5555555555555556 + ], + [ + 9, + 1 + ], + [ + 1, + 0.1111111111111111 + ], + [ + 9, + 1 + ], + [ + 9, + 1 + ], + [ + 3, + 0.375 + ], + [ + 3, + 0.375 + ], + [ + 8, + 1 + ], + [ + 0, + 0 + ], + [ + 0, + 0 + ], + [ + 7, + 1 + ], + [ + 7, + 1 + ], + [ + 0, + 0 + ], + [ + 4, + 0.5714285714285714 + ], + [ + 0, + 0 + ], + [ + 6, + 1 + ], + [ + 5, + 1 + ], + [ + 0, + 0 + ], + [ + 3, + 0.6 + ], + [ + 5, + 1 + ], + [ + 0, + 0 + ], + [ + 0, + 0 + ], + [ + 0, + 0 + ], + [ + 0, + 0 + ], + [ + 0, + 0 + ] + ], + "hovertemplate": "city: %{source.label} + product_code: %{target.label} = %{value:.0f}
+ price_issue:True = %{customdata[0]}
Proportion = %{customdata[1]:.1%}", + "source": [ + 13, + 20, + 11, + 18, + 20, + 15, + 13, + 20, + 17, + 11, + 13, + 13, + 13, + 18, + 11, + 14, + 9, + 13, + 11, + 19, + 18, + 17, + 21, + 11, + 17, + 2, + 17, + 19, + 13, + 12, + 12, + 13, + 14, + 7, + 17, + 9, + 18, + 15, + 7, + 19, + 9, + 18, + 21, + 18, + 2, + 9, + 20, + 2, + 12, + 11, + 2, + 18, + 15, + 9, + 7, + 14, + 15, + 19, + 19, + 15, + 16, + 21, + 7, + 15, + 17, + 2, + 16, + 2, + 21, + 15, + 11, + 16, + 19, + 16, + 16, + 14, + 18, + 19, + 12, + 14, + 17, + 12, + 14, + 21, + 9, + 15, + 19, + 14, + 2, + 11, + 9, + 20, + 9, + 2, + 12, + 16, + 20, + 20 + ], + "target": [ + 3, + 0, + 4, + 1, + 8, + 3, + 1, + 3, + 0, + 10, + 8, + 4, + 0, + 0, + 3, + 5, + 5, + 10, + 8, + 8, + 6, + 10, + 5, + 5, + 1, + 4, + 8, + 5, + 5, + 4, + 6, + 6, + 8, + 0, + 6, + 1, + 4, + 0, + 3, + 10, + 3, + 8, + 6, + 10, + 8, + 6, + 1, + 0, + 5, + 1, + 6, + 5, + 6, + 10, + 1, + 10, + 1, + 6, + 4, + 8, + 8, + 0, + 10, + 4, + 5, + 5, + 6, + 1, + 4, + 10, + 6, + 5, + 0, + 3, + 0, + 4, + 3, + 3, + 8, + 3, + 3, + 1, + 6, + 10, + 0, + 5, + 1, + 1, + 3, + 0, + 8, + 10, + 4, + 10, + 3, + 1, + 4, + 5 + ], + "value": [ + 110, + 105, + 101, + 81, + 71, + 61, + 58, + 55, + 49, + 48, + 47, + 44, + 44, + 40, + 40, + 34, + 33, + 33, + 32, + 31, + 31, + 31, + 30, + 30, + 30, + 29, + 29, + 27, + 26, + 26, + 25, + 24, + 23, + 22, + 21, + 21, + 21, + 21, + 20, + 20, + 20, + 19, + 19, + 18, + 18, + 18, + 18, + 18, + 17, + 16, + 16, + 16, + 16, + 15, + 15, + 15, + 14, + 13, + 13, + 13, + 13, + 12, + 12, + 11, + 11, + 11, + 11, + 11, + 11, + 10, + 10, + 10, + 9, + 9, + 9, + 9, + 9, + 9, + 8, + 8, + 8, + 7, + 7, + 7, + 7, + 7, + 7, + 6, + 6, + 5, + 5, + 5, + 5, + 5, + 5, + 4, + 4, + 4 + ] + }, + "node": { + "color": "#AA0DFE", + "label": [ + "A ", + "B ", + "Brookside", + "C ", + "D ", + "E ", + "F ", + "Forestville", + "G ", + "Greenfield", + "H ", + "Hilltop", + "Hilltown", + "Lakeside", + "Meadowville", + "Mountainview", + "Riverbend", + "Riverside", + "Rivertown", + "Seaside", + "Springfield", + "Valleyview" + ], + "line": { + "color": "black", + "width": 0.5 + }, + "pad": 15, + "thickness": 20 + }, + "type": "sankey" + } + ], + "layout": { + "font": { + "size": 14 + }, + "height": 600, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "city—product_code links for all Customer records,
colored by proportion with price_issue:True" + }, + "width": 1000 + } + }, + "text/html": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "# Create example alluvial/flow chart of city-product relationships\n", "flow_chart, flow_chart_df = acd.get_flow_chart_fig(\n", From d0e20be1a9e4035deb07e51e94229b51c679a779 Mon Sep 17 00:00:00 2001 From: Dayenne Souza Date: Wed, 30 Oct 2024 15:39:49 -0300 Subject: [PATCH 6/6] fix ccg --- example_notebooks/compare_case_groups.ipynb | 159 +- example_notebooks/detect_case_patterns.ipynb | 76 +- .../customer_complaints_group_report_1.md | 85 +- .../customer_complaints_group_report_2.md | 166 +- .../customer_complaints_group_report_3.md | 52 +- .../customer_complaints_summary.csv | 14406 +++++----------- toolkit/detect_case_patterns/model.py | 9 +- 7 files changed, 5011 insertions(+), 9942 deletions(-) diff --git a/example_notebooks/compare_case_groups.ipynb b/example_notebooks/compare_case_groups.ipynb index da17ef6d..81652161 100644 --- a/example_notebooks/compare_case_groups.ipynb +++ b/example_notebooks/compare_case_groups.ipynb @@ -49,8 +49,9 @@ "source": [ "# Create the workflow object\n", "import os\n", + "from toolkit.helpers import df_functions\n", "from toolkit.AI.openai_configuration import OpenAIConfiguration\n", - "\n", + "import pandas as pd\n", "\n", "ccg = CompareCaseGroups()\n", "\n", @@ -64,7 +65,8 @@ "ccg.set_ai_configuration(ai_configuration)\n", "\n", "data_path = \"../example_outputs/compare_case_groups/customer_complaints/customer_complaints_prepared.csv\"\n", - "customer_cases = pl.read_csv(data_path)\n", + "customer_cases = pd.read_csv(data_path)\n", + "customer_cases = pl.from_pandas(df_functions.supress_boolean_binary(customer_cases))\n", "print(\"Loaded data\")" ] }, @@ -127,6 +129,26 @@ "cell_type": "code", "execution_count": 5, "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "9646" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(ccg.model_df)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, "outputs": [ { "data": { @@ -138,7 +160,7 @@ " white-space: pre-wrap;\n", "}\n", "\n", - "shape: (5, 10)
citygroup_countgroup_rankattribute_valueattribute_countattribute_rankperiod_windowperiod_window_countperiod_window_rankperiod_window_delta
stru32i32stru32i32stru32i32i32
"Baytown"850"delivery_issue…649"2020-H1"140
"Baytown"850"delivery_issue…256"2020-H1"030
"Baytown"850"description_is…556"2020-H1"140
"Baytown"850"description_is…341"2020-H1"030
"Baytown"850"price_issue:fa…556"2020-H1"140
" + "shape: (5, 10)
citygroup_countgroup_rankattribute_valueattribute_countattribute_rankperiod_windowperiod_window_countperiod_window_rankperiod_window_delta
stru32i32stru32i32stru32i32i32
"Baytown"850"delivery_issue…256"2020-H1"030
"Baytown"850"description_is…341"2020-H1"030
"Baytown"850"price_issue:Tr…350"2020-H1"020
"Baytown"850"product_code:A…138"2020-H1"020
"Baytown"850"product_code:D…227"2020-H1"020
" ], "text/plain": [ "shape: (5, 10)\n", @@ -149,24 +171,22 @@ "│ ┆ u32 ┆ i32 ┆ str ┆ ┆ str ┆ --- ┆ i32 ┆ --- │\n", "│ ┆ ┆ ┆ ┆ ┆ ┆ u32 ┆ ┆ i32 │\n", "╞═════════╪════════════╪═══════════╪═══════════╪═══╪═══════════╪═══════════╪═══════════╪═══════════╡\n", - "│ Baytown ┆ 8 ┆ 50 ┆ delivery_ ┆ … ┆ 2020-H1 ┆ 1 ┆ 4 ┆ 0 │\n", - "│ ┆ ┆ ┆ issue:fal ┆ ┆ ┆ ┆ ┆ │\n", - "│ ┆ ┆ ┆ se ┆ ┆ ┆ ┆ ┆ │\n", "│ Baytown ┆ 8 ┆ 50 ┆ delivery_ ┆ … ┆ 2020-H1 ┆ 0 ┆ 3 ┆ 0 │\n", - "│ ┆ ┆ ┆ issue:tru ┆ ┆ ┆ ┆ ┆ │\n", + "│ ┆ ┆ ┆ issue:Tru ┆ ┆ ┆ ┆ ┆ │\n", "│ ┆ ┆ ┆ e ┆ ┆ ┆ ┆ ┆ │\n", - "│ Baytown ┆ 8 ┆ 50 ┆ descripti ┆ … ┆ 2020-H1 ┆ 1 ┆ 4 ┆ 0 │\n", - "│ ┆ ┆ ┆ on_issue: ┆ ┆ ┆ ┆ ┆ │\n", - "│ ┆ ┆ ┆ false ┆ ┆ ┆ ┆ ┆ │\n", "│ Baytown ┆ 8 ┆ 50 ┆ descripti ┆ … ┆ 2020-H1 ┆ 0 ┆ 3 ┆ 0 │\n", "│ ┆ ┆ ┆ on_issue: ┆ ┆ ┆ ┆ ┆ │\n", - "│ ┆ ┆ ┆ true ┆ ┆ ┆ ┆ ┆ │\n", - "│ Baytown ┆ 8 ┆ 50 ┆ price_iss ┆ … ┆ 2020-H1 ┆ 1 ┆ 4 ┆ 0 │\n", - "│ ┆ ┆ ┆ ue:false ┆ ┆ ┆ ┆ ┆ │\n", + "│ ┆ ┆ ┆ True ┆ ┆ ┆ ┆ ┆ │\n", + "│ Baytown ┆ 8 ┆ 50 ┆ price_iss ┆ … ┆ 2020-H1 ┆ 0 ┆ 2 ┆ 0 │\n", + "│ ┆ ┆ ┆ ue:True ┆ ┆ ┆ ┆ ┆ │\n", + "│ Baytown ┆ 8 ┆ 50 ┆ product_c ┆ … ┆ 2020-H1 ┆ 0 ┆ 2 ┆ 0 │\n", + "│ ┆ ┆ ┆ ode:A ┆ ┆ ┆ ┆ ┆ │\n", + "│ Baytown ┆ 8 ┆ 50 ┆ product_c ┆ … ┆ 2020-H1 ┆ 0 ┆ 2 ┆ 0 │\n", + "│ ┆ ┆ ┆ ode:D ┆ ┆ ┆ ┆ ┆ │\n", "└─────────┴────────────┴───────────┴───────────┴───┴───────────┴───────────┴───────────┴───────────┘" ] }, - "execution_count": 5, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -177,7 +197,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -186,7 +206,7 @@ "'This table shows:\\n- A summary of all **2769** data records with values for all grouping attributes\\n- The **group_count** of records for all [**city**] groups, and corresponding **group_rank**\\n- The **attribute_count** of each **attribute_value** for all [**city**] groups, and corresponding **attribute_rank**\\n- The **period_window_count** of each **attribute_value** for each **period_window** for all [**city**] groups, and corresponding **period_window_rank**\\n- The **period_window_delta**, or change in the **attribute_value_count** for successive **period_window** values, within each [**city**] group'" ] }, - "execution_count": 6, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -197,76 +217,125 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "# Select groups to generate reports\n", "# By group name\n", - "selected_groups = [\"Lakeside\"]\n", + "selected_groups = [{\"city\": \"Lakeside\"}]\n", "# OR\n", "# By top n groups\n", "top_group_ranks = 10\n", "\n", - "report_data, filter_description = ccg.get_report_data(selected_groups=selected_groups)" + "report_data, filter_description = ccg.get_report_data(top_group_ranks=top_group_ranks)" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "# Group Comparison Report: Lakeside\n", + "# Group Comparison Report\n", "\n", "## Introduction\n", "\n", - "This report focuses on the dataset filtered to include only the city group \"Lakeside.\" The dataset provides a comprehensive overview of various issues and product codes over different time periods, from the first half of 2020 to the second half of 2026. The analysis includes counts, ranks, and changes in these attributes over time.\n", + "This report provides a detailed comparison of the top 10 city groups based on record count from a dataset containing 2769 records. The dataset includes information on various issues and product codes across different time periods. The focus is on analyzing the trends and changes in these attributes over time for each city group.\n", + "\n", + "## Group Filters\n", "\n", - "## Data Summary\n", + "The dataset is filtered to include only the top 10 city groups by record count. These groups are:\n", "\n", - "The dataset consists of 349 records for the city group \"Lakeside.\" The analysis covers several attributes, including delivery issues, description issues, price issues, product codes, quality issues, and service issues. Each attribute is evaluated for its occurrence and rank within the group, as well as its changes over successive time periods.\n", + "1. Lakeside (349 records)\n", + "2. Springfield (265 records)\n", + "3. Hilltop (259 records)\n", + "4. Rivertown (204 records)\n", + "5. Riverside (184 records)\n", + "6. Seaside (127 records)\n", + "7. Mountainview (119 records)\n", + "8. Brookside (111 records)\n", + "9. Greenfield (104 records)\n", + "10. Meadowville (94 records)\n", "\n", "## Key Findings\n", "\n", - "### Delivery Issues\n", + "### Lakeside\n", + "\n", + "- **Record Count**: Lakeside has the highest record count with 349 records.\n", + "- **Top Issues**: Quality and service issues are the most frequent, each with 123 occurrences (rank 1).\n", + "- **Product Codes**: Product code C is the most common with 102 occurrences (rank 1).\n", + "- **Trends**: There was a significant increase in price issues in 2023-H1 (31 occurrences, delta +27) and a subsequent decrease in 2024-H1 (0 occurrences, delta -48).\n", + "\n", + "### Springfield\n", + "\n", + "- **Record Count**: Springfield ranks second with 265 records.\n", + "- **Top Issues**: Quality issues are the most frequent with 96 occurrences (rank 2).\n", + "- **Product Codes**: Product code A is the most common with 98 occurrences (rank 1).\n", + "- **Trends**: There was a notable increase in delivery issues in 2023-H1 (44 occurrences, delta +43) followed by a decrease in 2024-H1 (0 occurrences, delta -38).\n", + "\n", + "### Hilltop\n", + "\n", + "- **Record Count**: Hilltop ranks third with 259 records.\n", + "- **Top Issues**: Delivery issues are the most frequent with 104 occurrences (rank 1).\n", + "- **Product Codes**: Product code D is the most common with 107 occurrences (rank 1).\n", + "- **Trends**: There was a significant increase in service issues in 2023-H2 (55 occurrences, delta +39).\n", + "\n", + "### Rivertown\n", + "\n", + "- **Record Count**: Rivertown ranks fourth with 204 records.\n", + "- **Top Issues**: Quality issues are the most frequent with 92 occurrences (rank 3).\n", + "- **Product Codes**: Product code B is the most common with 79 occurrences (rank 1).\n", + "- **Trends**: There was a substantial increase in price issues in 2023-H1 (39 occurrences, delta +35) followed by a decrease in 2023-H2 (17 occurrences, delta -22).\n", + "\n", + "### Riverside\n", "\n", - "- **False Delivery Issues**: The count of records without delivery issues is consistently high, with a peak in the second half of 2023 (124 records, rank 1). There is a significant increase in the first half of 2023 (76 records, delta +63) compared to the previous period.\n", - "- **True Delivery Issues**: The count of records with delivery issues remains relatively low, with a notable increase in the second half of 2023 (40 records, rank 2, delta +22).\n", + "- **Record Count**: Riverside ranks fifth with 184 records.\n", + "- **Top Issues**: Price issues are the most frequent with 76 occurrences (rank 3).\n", + "- **Product Codes**: Product code A is the most common with 41 occurrences (rank 3).\n", + "- **Trends**: There was a notable increase in description issues in 2023-H1 (39 occurrences, delta +37).\n", "\n", - "### Description Issues\n", + "### Seaside\n", "\n", - "- **False Description Issues**: The records without description issues show a similar pattern to delivery issues, with a peak in the second half of 2023 (131 records, rank 1). The first half of 2023 also shows a substantial increase (76 records, delta +63).\n", - "- **True Description Issues**: The records with description issues increase in the second half of 2023 (33 records, rank 1, delta +15).\n", + "- **Record Count**: Seaside ranks sixth with 127 records.\n", + "- **Top Issues**: Service issues are the most frequent with 44 occurrences (rank 6).\n", + "- **Product Codes**: Product code G is the most common with 25 occurrences (rank 5).\n", + "- **Trends**: There was a significant increase in delivery issues in 2023-H1 (23 occurrences, delta +18).\n", "\n", - "### Price Issues\n", + "### Mountainview\n", "\n", - "- **False Price Issues**: The count of records without price issues peaks in the second half of 2023 (116 records, rank 1), with a significant increase in the first half of 2023 (63 records, delta +49).\n", - "- **True Price Issues**: The records with price issues also increase in the second half of 2023 (48 records, rank 1, delta +17).\n", + "- **Record Count**: Mountainview ranks seventh with 119 records.\n", + "- **Top Issues**: Delivery issues are the most frequent with 58 occurrences (rank 4).\n", + "- **Product Codes**: Product code C is the most common with 54 occurrences (rank 2).\n", + "- **Trends**: There was a substantial increase in description issues in 2023-H1 (32 occurrences, delta +28).\n", "\n", - "### Product Codes\n", + "### Brookside\n", "\n", - "- **Product Code A**: The count of records with product code A increases in the second half of 2023 (29 records, rank 1, delta +21).\n", - "- **Product Code B**: The records with product code B show a steady increase, peaking in the second half of 2023 (26 records, rank 1, delta +2).\n", - "- **Product Code C**: The count of records with product code C increases in the second half of 2023 (27 records, rank 2, delta +4).\n", - "- **Product Code D**: The records with product code D show a significant increase in the second half of 2023 (35 records, rank 2, delta +28).\n", + "- **Record Count**: Brookside ranks eighth with 111 records.\n", + "- **Top Issues**: Price issues are the most frequent with 45 occurrences (rank 6).\n", + "- **Product Codes**: Product code F is the most common with 23 occurrences (rank 4).\n", + "- **Trends**: There was a significant increase in price issues in 2023-H1 (27 occurrences, delta +27).\n", "\n", - "### Quality Issues\n", + "### Greenfield\n", "\n", - "- **False Quality Issues**: The records without quality issues peak in the second half of 2023 (86 records, rank 2, delta +26).\n", - "- **True Quality Issues**: The records with quality issues increase significantly in the second half of 2023 (78 records, rank 1, delta +44).\n", + "- **Record Count**: Greenfield ranks ninth with 104 records.\n", + "- **Top Issues**: Description issues are the most frequent with 38 occurrences (rank 5).\n", + "- **Product Codes**: Product code E is the most common with 25 occurrences (rank 4).\n", + "- **Trends**: There was a notable increase in description issues in 2023-H1 (20 occurrences, delta +19).\n", "\n", - "### Service Issues\n", + "### Meadowville\n", "\n", - "- **False Service Issues**: The count of records without service issues peaks in the second half of 2023 (117 records, rank 1, delta +47).\n", - "- **True Service Issues**: The records with service issues also increase significantly in the second half of 2023 (47 records, rank 2, delta +23).\n", + "- **Record Count**: Meadowville ranks tenth with 94 records.\n", + "- **Top Issues**: Price issues are the most frequent with 30 occurrences (rank 11).\n", + "- **Product Codes**: Product code E is the most common with 33 occurrences (rank 1).\n", + "- **Trends**: There was a significant increase in delivery issues in 2023-H2 (17 occurrences, delta +11).\n", "\n", "## Conclusion\n", "\n", - "The analysis of the Lakeside group reveals significant trends in various issues and product codes over time. Notably, there are substantial increases in records without delivery, description, and price issues in the first half of 2023, followed by peaks in the second half of 2023. Similarly, records with true issues also show notable increases during these periods. The product codes exhibit varying trends, with some codes showing significant increases in the latter half of 2023. Overall, the data provides valuable insights into the dynamics of issues and product codes within the Lakeside group over the analyzed periods.\n" + "The analysis reveals distinct patterns and trends in issues and product codes across the top 10 city groups. Lakeside and Springfield show the highest record counts, with quality and service issues being prevalent. Significant changes in issue occurrences are observed in various periods, indicating potential areas for further investigation and improvement.\n" ] } ], diff --git a/example_notebooks/detect_case_patterns.ipynb b/example_notebooks/detect_case_patterns.ipynb index 3ecfcae6..a18bd55f 100644 --- a/example_notebooks/detect_case_patterns.ipynb +++ b/example_notebooks/detect_case_patterns.ipynb @@ -20,13 +20,14 @@ "name": "stderr", "output_type": "stream", "text": [ - "c:\\Users\\daedge\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\intelligence-toolkit-lXFNld9n-py3.11\\Lib\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", - " from .autonotebook import tqdm as notebook_tqdm\n" + "/home/ddesouza/Projects/intelligence-toolkit/.venv/lib/python3.11/site-packages/sentence_transformers/cross_encoder/CrossEncoder.py:13: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", + " from tqdm.autonotebook import tqdm, trange\n" ] } ], "source": [ "import sys\n", + "\n", "sys.path.append(\"..\")\n", "import os\n", "from toolkit.detect_case_patterns import DetectCasePatterns\n", @@ -50,6 +51,9 @@ ], "source": [ "# Create the workflow object\n", + "from toolkit.helpers import df_functions\n", + "\n", + "\n", "dcp = DetectCasePatterns()\n", "# Set the AI configuration\n", "ai_configuration = OpenAIConfiguration(\n", @@ -64,7 +68,7 @@ "data_path = \"../example_outputs/detect_case_patterns/customer_complaints/customer_complaints_prepared.csv\"\n", "case_data = pd.read_csv(data_path)\n", "# Map missing values and binary False to empty strings, since we only care about the presence of attributes\n", - "case_data = case_data.astype(str).replace(\"False\", \"\").replace(\"nan\", \"\")\n", + "case_data = df_functions.supress_boolean_binary(case_data)\n", "print(\"Loaded data\")" ] }, @@ -83,10 +87,7 @@ ], "source": [ "# Generate the graph model\n", - "dcp.generate_graph_model(\n", - " df=case_data,\n", - " period_col=\"period\"\n", - ")\n", + "dcp.generate_graph_model(df=case_data, period_col=\"period\")\n", "print(\"Generated graph model\")" ] }, @@ -124,10 +125,7 @@ ], "source": [ "# Detect the case patterns\n", - "dcp.detect_patterns(\n", - " min_pattern_count=10,\n", - " max_pattern_length=5\n", - ")\n", + "dcp.detect_patterns(min_pattern_count=10, max_pattern_length=5)\n", "print(\"Detected case patterns\")" ] }, @@ -219,6 +217,7 @@ "name": "stdout", "output_type": "stream", "text": [ + "Computing attribute counts for pattern: age_range:(50-60] & city:Springfield & delivery_issue:True & product_code:G & service_issue:True with period: 2023-H1 for period column: period\n", " AttributeValue Count\n", "0 age_range:(50-60] 18\n", "1 city:Springfield 18\n", @@ -235,7 +234,7 @@ "# Compute related attribute counts for the example pattern\n", "att_counts = dcp.compute_attribute_counts(\n", " selected_pattern=example_pattern[\"pattern\"],\n", - " selected_pattern_period=example_pattern[\"period\"]\n", + " selected_pattern_period=example_pattern[\"period\"],\n", ")\n", "print(att_counts)" ] @@ -249,9 +248,9 @@ "name": "stderr", "output_type": "stream", "text": [ - "c:\\Users\\daedge\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\intelligence-toolkit-lXFNld9n-py3.11\\Lib\\site-packages\\altair\\utils\\core.py:384: FutureWarning: the convert_dtype parameter is deprecated and will be removed in a future version. Do ``ser.astype(object).apply()`` instead if you want ``convert_dtype=False``.\n", + "/home/ddesouza/Projects/intelligence-toolkit/.venv/lib/python3.11/site-packages/altair/utils/core.py:384: FutureWarning: the convert_dtype parameter is deprecated and will be removed in a future version. Do ``ser.astype(object).apply()`` instead if you want ``convert_dtype=False``.\n", " col = df[col_name].apply(to_list_if_array, convert_dtype=False)\n", - "c:\\Users\\daedge\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\intelligence-toolkit-lXFNld9n-py3.11\\Lib\\site-packages\\altair\\utils\\core.py:384: FutureWarning: the convert_dtype parameter is deprecated and will be removed in a future version. Do ``ser.astype(object).apply()`` instead if you want ``convert_dtype=False``.\n", + "/home/ddesouza/Projects/intelligence-toolkit/.venv/lib/python3.11/site-packages/altair/utils/core.py:384: FutureWarning: the convert_dtype parameter is deprecated and will be removed in a future version. Do ``ser.astype(object).apply()`` instead if you want ``convert_dtype=False``.\n", " col = df[col_name].apply(to_list_if_array, convert_dtype=False)\n" ] }, @@ -259,13 +258,13 @@ "data": { "text/html": [ "\n", - "
\n", + "
\n", "