diff --git a/all-block-types-no-outputs.deepnote b/all-block-types-no-outputs.deepnote new file mode 100644 index 0000000..71ada7b --- /dev/null +++ b/all-block-types-no-outputs.deepnote @@ -0,0 +1,738 @@ +metadata: + createdAt: 2025-09-16T10:11:17.611Z + modifiedAt: 2025-09-17T09:30:51.468Z +project: + id: c4604eab-9672-4d68-ab40-4c27af41fbc7 + name: all-block-types + notebooks: + - blocks: + - content: Code + id: f6359663a8984338a1b2c4cfd0d4c171 + metadata: + formattedRanges: [] + sortingKey: a0 + type: text-cell-p + - content: |- + import pandas as pd + import numpy as np + + # Create sample data + data = { + 'Name': ['John', 'Emma', 'Michael', 'Sarah', 'David'], + 'Age': [28, 34, 42, 25, 31], + 'Salary': [65000, 78000, 95000, 62000, 70000], + 'Department': ['IT', 'HR', 'Finance', 'Marketing', 'IT'], + 'Experience': [3, 7, 12, 2, 5] + } + + # Create DataFrame + df = pd.DataFrame(data) + + # Create salary_max variable + salary_max = df['Salary'].max() + + # Create salary_min variable + salary_min = df['Salary'].min() + + # Display the DataFrame + df + executionCount: 1 + id: 347b6e16651c453881cf75a0c7365618 + metadata: + execution_start: 1758017228976 + execution_millis: 13 + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + outputs: [] + sortingKey: m + type: code + - content: Markdown + id: f8e64035510d4918a22bbac0bc997982 + metadata: + formattedRanges: [] + sortingKey: s + type: text-cell-p + - content: >- + # Markdown heading + + + Markdown body text with a [link](https://www.google.com) and a + **bold** word. + id: 73f558db2f114d50b4eca9ebbff82870 + metadata: {} + sortingKey: v + type: markdown + - content: Paragraph + id: 34aebdcb65d84cdba24cc6b0185beeba + metadata: + formattedRanges: [] + sortingKey: x + type: text-cell-p + - content: A paragraph of text + id: f0a69c045b0b4a47ac3a19ca2e04cad7 + metadata: + formattedRanges: [] + sortingKey: y + type: text-cell-p + - content: Heading 1 + id: 300cda58d0814c928dd3bfeb72965696 + metadata: + formattedRanges: [] + sortingKey: yU + type: text-cell-p + - content: Heading 1 + id: 1cf63fe584e6403bb1c646f6481ed1e1 + metadata: + formattedRanges: [] + sortingKey: yj + type: text-cell-h1 + - content: Heading 2 + id: b3aa9896fc6e4b97ba3eed8fdfb8995a + metadata: + formattedRanges: [] + sortingKey: yr + type: text-cell-p + - content: Heading 2 + id: 9ede33b832b14c7781888a2f778f6785 + metadata: + formattedRanges: [] + sortingKey: yv + type: text-cell-h2 + - content: Heading 3 + id: 1fdd93c5ff004dac896214c52c2111e9 + metadata: + formattedRanges: [] + sortingKey: yx + type: text-cell-p + - content: Heading 3 + id: 6514a011a46a4a149046d188ab0eb271 + metadata: + formattedRanges: [] + sortingKey: yy + type: text-cell-h3 + - content: Bulleted list + id: faa890e3bdc647039b735657ad0aefbf + metadata: + formattedRanges: [] + sortingKey: yyU + type: text-cell-p + - content: Bullet one + id: aec4ba3615954acaabdedf70f142c332 + metadata: + formattedRanges: [] + sortingKey: yyj + type: text-cell-bullet + - content: Bullet two + id: 9f9f6c22499645a0945b46ec2ab5998a + metadata: + formattedRanges: [] + sortingKey: yyr + type: text-cell-bullet + - content: Bullet three + id: 6a1360e12cf648078226ee019c87f483 + metadata: + formattedRanges: [] + sortingKey: yyv + type: text-cell-bullet + - content: To-do list + id: 54fea078b60b40caa7ed54d98b74c2f7 + metadata: + formattedRanges: [] + sortingKey: yyx + type: text-cell-p + - content: To-do item one + id: b8213fd33984429da8ab939a6cafe53f + metadata: + formattedRanges: [] + sortingKey: yyy + type: text-cell-todo + - content: To-do item two + id: 8757f7e24b824c6e8c1c2ee3e76e5e50 + metadata: + checked: false + formattedRanges: [] + sortingKey: yyyU + type: text-cell-todo + - content: To-do item three + id: 30cf5a1a68fc4579ae86a498ab916ab3 + metadata: + checked: false + formattedRanges: [] + sortingKey: yyyj + type: text-cell-todo + - content: Callout + id: b6729542fe4c47079a398657a66a75c3 + metadata: + formattedRanges: [] + sortingKey: yyyr + type: text-cell-p + - content: A callout with some text + id: b3dc04fdfc9c4571be3a960e9674e3a1 + metadata: + formattedRanges: [] + sortingKey: yyyv + type: text-cell-callout + - content: Separator + id: 3cb803815f694153bbf763d4f82772f2 + metadata: + formattedRanges: [] + sortingKey: yyyx + type: text-cell-p + - content: "" + id: 091223f162044c2bab926c0f36a688e8 + metadata: {} + sortingKey: yyyy + type: separator + - content: SQL + id: de73a7dcfae44252acb9e92f46008bc1 + metadata: + formattedRanges: [] + sortingKey: yyyyU + type: text-cell-p + - content: SELECT * FROM df; + executionCount: 2 + id: 3cbce657e51247f2b01b730661260cb3 + metadata: + execution_start: 1758017229128 + execution_millis: 371 + sql_integration_id: deepnote-dataframe-sql + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: df + outputs: [] + sortingKey: yyyyj + type: sql + - content: Chat + id: b4d48a1639bc4a8b83a7b4000085a862 + metadata: + formattedRanges: [] + sortingKey: yyyyr + type: text-cell-p + - content: "" + executionCount: 3 + id: 157db3d3f69845be87d3eee17eb677fe + metadata: + execution_start: 1758017230093 + execution_millis: 125 + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: df + deepnote_visualization_spec: + layer: + - layer: + - layer: + - mark: + clip: true + type: bar + color: "#2266D3" + tooltip: true + encoding: + x: + axis: + title: Employee name + sort: null + type: nominal + field: Name + scale: + type: linear + y: + axis: + title: Salary + format: + type: number + decimals: null + formatType: numberFormatFromNumberType + type: quantitative + field: Salary + scale: + type: linear + format: + type: default + decimals: null + aggregate: sum + formatType: numberFormatFromNumberType + color: + type: nominal + datum: Salary + scale: + range: + - "#2266D3" + domain: + - Salary + xOffset: + datum: series_0 + transform: [] + resolve: + scale: + color: independent + title: Salary by employee + config: + legend: + disable: false + $schema: https://vega.github.io/schema/vega-lite/v5.json + encoding: {} + usermeta: + seriesNames: + - Salary + seriesOrder: + - 0 + specSchemaVersion: 2 + tooltipDefaultMode: true + outputs: [] + sortingKey: yyyyv + type: visualization + - content: Big number + id: 4792b856d35b40c3ac4ecc880513ba67 + metadata: + formattedRanges: [] + sortingKey: yyyyx + type: text-cell-p + - content: > + + def __deepnote_big_number__(): + import json + import jinja2 + from jinja2 import meta + + def render_template(template): + parsed_content = jinja2.Environment().parse(template) + + required_variables = meta.find_undeclared_variables(parsed_content) + + context = { + variable_name: globals().get(variable_name) + for variable_name in required_variables + } + + result = jinja2.Environment().from_string(template).render(context) + + return result + + rendered_title = render_template("Max salary") + rendered_comparison_title = render_template("Difference with min") + + return json.dumps({ + "comparisonTitle": rendered_comparison_title, + "comparisonValue": f"{salary_min}", + "title": rendered_title, + "value": f"{salary_max}" + }) + + __deepnote_big_number__() + executionCount: 4 + id: 63bd93dd0c7b4940bb7e2f281ef527ea + metadata: + execution_start: 1758017230260 + execution_millis: 1 + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_big_number_title: Max salary + deepnote_big_number_value: salary_max + deepnote_big_number_format: currency + deepnote_big_number_comparison_type: "" + deepnote_big_number_comparison_title: Difference with min + deepnote_big_number_comparison_value: salary_min + deepnote_big_number_comparison_format: "" + deepnote_big_number_comparison_enabled: true + outputs: [] + sortingKey: yyyyy + type: big-number + - content: Text input + id: b4ef3456ab3541d59c32127a4ec3623a + metadata: + formattedRanges: [] + sortingKey: yyyyyU + type: text-cell-p + - content: text_input = '' + executionCount: 5 + id: 9617772dd620494588d82ff362f8723b + metadata: + execution_start: 1758017230310 + execution_millis: 0 + deepnote_input_label: Text input display name + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: text_input + deepnote_variable_value: "" + deepnote_variable_default_value: Some text input value + outputs: [] + sortingKey: yyyyyj + type: input-text + - content: Text area input + id: d68f1407519648cf9352322a78706262 + metadata: + formattedRanges: [] + sortingKey: yyyyyr + type: text-cell-p + - content: text_area_input = '' + executionCount: 6 + id: 78b702ad9e4249c6a734e6540fd6d594 + metadata: + execution_start: 1758017230360 + execution_millis: 0 + deepnote_input_label: Text area input + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: text_area_input + deepnote_variable_value: "" + deepnote_variable_default_value: Some text area value + outputs: [] + sortingKey: yyyyyv + type: input-textarea + - content: Select input + id: 6b4cf64deb7e4889a12ff8224f403e6e + metadata: + formattedRanges: [] + sortingKey: yyyyyx + type: text-cell-p + - content: select_input = 'Option 1' + executionCount: 7 + id: ad0dc815587c414e8350b7b2c277f526 + metadata: + execution_start: 1758017230410 + execution_millis: 0 + deepnote_input_label: Select input display name + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: select_input + deepnote_variable_value: Option 1 + deepnote_variable_options: + - Option 1 + - Option 2 + deepnote_variable_select_type: from-options + deepnote_variable_default_value: Option 1 + deepnote_variable_custom_options: + - Option 1 + - Option 2 + deepnote_variable_selected_variable: "" + outputs: [] + sortingKey: yyyyyy + type: input-select + - content: Slider input + id: d71623200b3a4139b78a3f64f11d1fee + metadata: + formattedRanges: [] + sortingKey: yyyyyyU + type: text-cell-p + - content: slider_input = 5 + executionCount: 8 + id: f5bde14ac91b4c619d4721119f6dc097 + metadata: + execution_start: 1758017230460 + execution_millis: 0 + deepnote_input_label: Slider input display name + deepnote_slider_step: 1 + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: slider_input + deepnote_variable_value: "5" + deepnote_slider_max_value: 10 + deepnote_slider_min_value: 0 + deepnote_variable_default_value: "7" + outputs: [] + sortingKey: yyyyyyj + type: input-slider + - content: Checkbox input + id: 1025124c6e2d423db37f1a2801d919c8 + metadata: + formattedRanges: [] + sortingKey: yyyyyyr + type: text-cell-p + - content: checkbox_input = False + executionCount: 9 + id: 2b8c96e18b9047e1abdbc1030e64e483 + metadata: + execution_start: 1758017230510 + execution_millis: 0 + deepnote_input_label: Checkbox input display name + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: checkbox_input + deepnote_variable_value: false + deepnote_input_checkbox_label: Checkbox label + deepnote_variable_default_value: true + outputs: [] + sortingKey: yyyyyyv + type: input-checkbox + - content: Date input + id: 5574b42d69b84dd485a5af45eed8ed24 + metadata: + formattedRanges: [] + sortingKey: yyyyyyx + type: text-cell-p + - content: | + + from dateutil.parser import parse as _deepnote_parse + date_input = _deepnote_parse('2025-09-16T00:00:00.000Z').date() + executionCount: 1 + id: da864431beb24d7ea254caf07469b64f + metadata: + execution_start: 1758101400493 + execution_millis: 1 + deepnote_input_label: Date input display name + execution_context_id: c8ddf739-5e27-4b0f-a7a1-6f638a515fbc + deepnote_variable_name: date_input + deepnote_variable_value: 2025-09-16T00:00:00.000Z + deepnote_input_date_version: 2 + deepnote_variable_default_value: 2025-08-27T00:00:00.000Z + outputs: [] + sortingKey: yyyyyyy + type: input-date + - content: Date range input + id: 453586f33cff44b8817b90f8fe96bb7c + metadata: + formattedRanges: [] + sortingKey: yyyyyyyU + type: text-cell-p + - content: date_range_input = [None, None] + executionCount: 11 + id: c0d58153fea24d749787d145a7184a95 + metadata: + execution_start: 1758017230610 + execution_millis: 0 + deepnote_input_label: Date range input display name + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: date_range_input + deepnote_variable_value: "" + deepnote_variable_default_value: + - 2025-08-12 + - 2025-08-14 + outputs: [] + sortingKey: yyyyyyyj + type: input-date-range + - content: File input + id: 067e15e2da45411996f2596f0b771bc2 + metadata: + formattedRanges: [] + sortingKey: yyyyyyyr + type: text-cell-p + - content: file_input = 'file_input_uploads/user_events_mini.csv' + executionCount: 12 + id: 4aaf723a72644849aeac5850a31899a0 + metadata: + execution_start: 1758017230660 + execution_millis: 0 + deepnote_input_label: File input display name + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: file_input + deepnote_variable_value: file_input_uploads/user_events_mini.csv + deepnote_allowed_file_extensions: .csv + outputs: [] + sortingKey: yyyyyyyv + type: input-file + - content: Button + id: 07b4d5b4d6974ee2bc1ba0cebc222756 + metadata: + formattedRanges: [] + sortingKey: yyyyyyyx + type: text-cell-p + - content: "" + id: a697f0202b9a4c67a4cb7120efef8867 + metadata: + execution_start: 1758017230710 + execution_millis: 0 + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_button_title: Set variable + deepnote_variable_name: button_input_set_variable + deepnote_button_behavior: set_variable + deepnote_button_color_scheme: blue + outputs: [] + sortingKey: yyyyyyyy + type: button + - content: "" + id: 8b4935f7cefe4d819cad51b66c93fd79 + metadata: + execution_start: 1758017230760 + execution_millis: 0 + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_button_title: Run notebook + deepnote_variable_name: button_1 + deepnote_button_behavior: run + deepnote_button_color_scheme: blue + outputs: [] + sortingKey: yyyyyyyyU + type: button + - content: Module + id: 0a334a952e274c2e915002636375b331 + metadata: + formattedRanges: [] + sortingKey: yyyyyyyyj + type: text-cell-p + - content: "" + executionCount: 1 + id: 8e613308b24f419eb550573eda2602ab + metadata: + execution_start: 1758017517949 + execution_millis: 145407 + execution_context_id: f5da58fe-0dad-4318-867a-0ab9925d7c28 + function_notebook_id: e960b15d27074d38a6b07ff87eb42c89 + function_notebook_inputs: {} + last_function_run_started_at: 1758017655789 + function_notebook_export_mappings: + Monthly_signups: + enabled: true + variable_name: Monthly_signups + last_executed_function_notebook_id: e960b15d27074d38a6b07ff87eb42c89 + outputs: [] + sortingKey: yyyyyyyyr + type: notebook-function + executionMode: block + id: 686ad8158f6947f9b2796fb1add22277 + isModule: false + name: All block types + workingDirectory: / + settings: + requirements: + - Please + - don't + - install + - "`jupyter`" + - or + - "`jedi`" + - packages, + - they + - would + - break + - your + - Deepnote + - environment. + - Also, + - no + - need + - to + - put + - "`!pip" + - install`s + - here, + - we + - already + - save + - those + - automatically! + - then + - ./requirements.txt + - fi + - unidecode + - cairosvg + - wordcloud + - pandas + - requests + - nltk + - vaderSentiment + - matplotlib + - seaborn + - transformers + - '"pandas>=2.0"' + - ipython + - requirements.txt + - python + - pip + - wheel + - plotly + - Finally, + - will + - sort + - the + - dataframe + - based + - on + - percentage + - change + - in + - descending + - order + - and + - select + - top + - "5." + - If + - "`yfinance`" + - is + - not + - installed + - Python + - environment, + - it + - using + - "`!yfinance`." + - pytrends + - pandas==1.1.0 + - /work/testmc-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl + - else + - Plotly + - a + - powerful + - library + - for + - creating + - interactive + - visualizations. + - In + - this + - notebook, + - used + - generate + - bar + - charts, + - line + - histograms. + - The + - "`!plotly`" + - command + - ensures + - that + - available + - use. + - note + - symbols + - provided + - are + - just + - reference. + - You + - can + - replace + - them + - according + - interests. + - code + - snippet + - assumes + - you + - have + - (`pd`) + - installed. + - not, + - "`!pandas`." + - jinja2 + - Jinja2==3.0.0 + - altair + - vega_datasets + - sentry-sdk + - responses + - parameterized + - python-socketio + - eventlet + - vllm + - . + - running + - after + - executing + - "!fastapi" + - '"sideloading' + - packages" + - notebook + - ipywidgets + - jupyterlab + - psutil + - Absolutely, + - here + - few + - examples + - of + - how + - Notion + - API + - be + - Python. + - It + - uses + - "`notion`" + - package. + - installed, + - via + - "`!notion`." + - "%fastapi" + - "%-q" +version: 1.0.0 diff --git a/all-block-types-no-outputs.ipynb b/all-block-types-no-outputs.ipynb new file mode 100644 index 0000000..3283107 --- /dev/null +++ b/all-block-types-no-outputs.ipynb @@ -0,0 +1,795 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "f6359663a8984338a1b2c4cfd0d4c171", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Code", + "block_group": "a2621902d0a7472595a71e28f01bb3da" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "8a1ac92c", + "execution_start": 1758017228976, + "execution_millis": 13, + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "cell_id": "347b6e16651c453881cf75a0c7365618", + "deepnote_cell_type": "code" + }, + "source": "import pandas as pd\nimport numpy as np\n\n# Create sample data\ndata = {\n 'Name': ['John', 'Emma', 'Michael', 'Sarah', 'David'],\n 'Age': [28, 34, 42, 25, 31],\n 'Salary': [65000, 78000, 95000, 62000, 70000],\n 'Department': ['IT', 'HR', 'Finance', 'Marketing', 'IT'],\n 'Experience': [3, 7, 12, 2, 5]\n}\n\n# Create DataFrame\ndf = pd.DataFrame(data)\n\n# Create salary_max variable\nsalary_max = df['Salary'].max()\n\n# Create salary_min variable\nsalary_min = df['Salary'].min()\n\n# Display the DataFrame\ndf", + "block_group": "2a432c3f8c6a4602a4299b5094cd1b35", + "execution_count": 1, + "outputs": [], + "outputs_reference": null, + "content_dependencies": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "f8e64035510d4918a22bbac0bc997982", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Markdown", + "block_group": "51672b4375be4e208ca0cb6d58ea17da" + }, + { + "cell_type": "markdown", + "metadata": { + "cell_id": "73f558db2f114d50b4eca9ebbff82870", + "deepnote_cell_type": "markdown" + }, + "source": "# Markdown heading\n\nMarkdown body text with a [link](https://www.google.com) and a **bold** word.", + "block_group": "10a282b7984f4ad98f90ac490c9bed3c" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "34aebdcb65d84cdba24cc6b0185beeba", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Paragraph", + "block_group": "7f88f5051e844b36a0cf97ddae05c9fc" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "f0a69c045b0b4a47ac3a19ca2e04cad7", + "deepnote_cell_type": "text-cell-p" + }, + "source": "A paragraph of text", + "block_group": "af1ca519408e49a3b766ebc98d77db48" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "300cda58d0814c928dd3bfeb72965696", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Heading 1", + "block_group": "550d948208fb4ced92d8600653be15b4" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "1cf63fe584e6403bb1c646f6481ed1e1", + "deepnote_cell_type": "text-cell-h1" + }, + "source": "# Heading 1", + "block_group": "9a7f7bf77b3b45f6becf7ae73e6eee62" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "b3aa9896fc6e4b97ba3eed8fdfb8995a", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Heading 2", + "block_group": "ac657f5a4adf478ba1b76a03c9d9361a" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "9ede33b832b14c7781888a2f778f6785", + "deepnote_cell_type": "text-cell-h2" + }, + "source": "## Heading 2", + "block_group": "371421bb44344a7d91a221f501ccc08c" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "1fdd93c5ff004dac896214c52c2111e9", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Heading 3", + "block_group": "8111c8912fbd4211a90ad965b6b79ec1" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "6514a011a46a4a149046d188ab0eb271", + "deepnote_cell_type": "text-cell-h3" + }, + "source": "### Heading 3", + "block_group": "259ddfd167f648e285a87d92577e2d41" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "faa890e3bdc647039b735657ad0aefbf", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Bulleted list", + "block_group": "9766707de7bc4685948657bff622b9f6" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "aec4ba3615954acaabdedf70f142c332", + "deepnote_cell_type": "text-cell-bullet" + }, + "source": "- Bullet one", + "block_group": "c9a02867dfa04173a4d2f51464fac194" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "9f9f6c22499645a0945b46ec2ab5998a", + "deepnote_cell_type": "text-cell-bullet" + }, + "source": "- Bullet two", + "block_group": "8d21db08da194515a3932e066f77fb77" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "6a1360e12cf648078226ee019c87f483", + "deepnote_cell_type": "text-cell-bullet" + }, + "source": "- Bullet three", + "block_group": "edc1ed0fb7614023bb7617fdc1c0abea" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "54fea078b60b40caa7ed54d98b74c2f7", + "deepnote_cell_type": "text-cell-p" + }, + "source": "To-do list", + "block_group": "f371ee9e94e1428ba8ec355e12dca38c" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "b8213fd33984429da8ab939a6cafe53f", + "deepnote_cell_type": "text-cell-todo" + }, + "source": "- [ ] To-do item one", + "block_group": "b50b2211535a4f9782fce8051cacac66" + }, + { + "cell_type": "markdown", + "metadata": { + "checked": false, + "formattedRanges": [], + "cell_id": "8757f7e24b824c6e8c1c2ee3e76e5e50", + "deepnote_cell_type": "text-cell-todo" + }, + "source": "- [ ] To-do item two", + "block_group": "0a4ff943c02e4fd4bfcf94a4ef386aa3" + }, + { + "cell_type": "markdown", + "metadata": { + "checked": false, + "formattedRanges": [], + "cell_id": "30cf5a1a68fc4579ae86a498ab916ab3", + "deepnote_cell_type": "text-cell-todo" + }, + "source": "- [ ] To-do item three", + "block_group": "888a33aafca844b6ac1597313858ef21" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "b6729542fe4c47079a398657a66a75c3", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Callout", + "block_group": "2d4e5049a24643c6a80a0a35559f8cc1" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "b3dc04fdfc9c4571be3a960e9674e3a1", + "deepnote_cell_type": "text-cell-callout" + }, + "source": "> A callout with some text", + "block_group": "e792897153f44d20ae6ffaefc0457262" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "3cb803815f694153bbf763d4f82772f2", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Separator", + "block_group": "db67578e7dd348a9a3b1eae1f677373d" + }, + { + "cell_type": "markdown", + "metadata": { + "cell_id": "091223f162044c2bab926c0f36a688e8", + "deepnote_cell_type": "separator" + }, + "source": "
", + "block_group": "7f45e1873f044edaabbf98eb954bb2f4" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "de73a7dcfae44252acb9e92f46008bc1", + "deepnote_cell_type": "text-cell-p" + }, + "source": "SQL", + "block_group": "c78377f47a68485d89d50951e8e28300" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "a3523be3", + "execution_start": 1758017229128, + "execution_millis": 371, + "sql_integration_id": "deepnote-dataframe-sql", + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "df", + "cell_id": "3cbce657e51247f2b01b730661260cb3", + "deepnote_cell_type": "sql", + "deepnote_sql_source": "SELECT * FROM df;" + }, + "source": "df = _dntk.execute_sql(\n 'SELECT * FROM df;',\n 'SQL_DEEPNOTE_DATAFRAME_SQL',\n audit_sql_comment='',\n sql_cache_mode='cache_disabled',\n return_variable_type='dataframe'\n)\ndf", + "block_group": "19c9f74d74b741f2b76c2bbb19b9e072", + "execution_count": 2, + "outputs": [], + "outputs_reference": null, + "content_dependencies": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "b4d48a1639bc4a8b83a7b4000085a862", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Chat", + "block_group": "90ed378eaa4d430d8f894680ca7a6b17" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "652dccd7", + "execution_start": 1758017230093, + "execution_millis": 125, + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "df", + "deepnote_visualization_spec": { + "layer": [ + { + "layer": [ + { + "layer": [ + { + "mark": { + "clip": true, + "type": "bar", + "color": "#2266D3", + "tooltip": true + }, + "encoding": { + "x": { + "axis": { + "title": "Employee name" + }, + "sort": null, + "type": "nominal", + "field": "Name", + "scale": { + "type": "linear" + } + }, + "y": { + "axis": { + "title": "Salary", + "format": { + "type": "number", + "decimals": null + }, + "formatType": "numberFormatFromNumberType" + }, + "type": "quantitative", + "field": "Salary", + "scale": { + "type": "linear" + }, + "format": { + "type": "default", + "decimals": null + }, + "aggregate": "sum", + "formatType": "numberFormatFromNumberType" + }, + "color": { + "type": "nominal", + "datum": "Salary", + "scale": { + "range": [ + "#2266D3" + ], + "domain": [ + "Salary" + ] + } + }, + "xOffset": { + "datum": "series_0" + } + }, + "transform": [] + } + ] + } + ], + "resolve": { + "scale": { + "color": "independent" + } + } + } + ], + "title": "Salary by employee", + "config": { + "legend": { + "disable": false + } + }, + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "encoding": {}, + "usermeta": { + "seriesNames": [ + "Salary" + ], + "seriesOrder": [ + 0 + ], + "specSchemaVersion": 2, + "tooltipDefaultMode": true + } + }, + "cell_id": "157db3d3f69845be87d3eee17eb677fe", + "deepnote_cell_type": "visualization" + }, + "source": "import inspect\n_dntk.DeepnoteChart(df, \"\"\"{\"layer\":[{\"layer\":[{\"layer\":[{\"mark\":{\"clip\":true,\"type\":\"bar\",\"color\":\"#2266D3\",\"tooltip\":true},\"encoding\":{\"x\":{\"axis\":{\"title\":\"Employee name\"},\"sort\":null,\"type\":\"nominal\",\"field\":\"Name\",\"scale\":{\"type\":\"linear\"}},\"y\":{\"axis\":{\"title\":\"Salary\",\"format\":{\"type\":\"number\",\"decimals\":null},\"formatType\":\"numberFormatFromNumberType\"},\"type\":\"quantitative\",\"field\":\"Salary\",\"scale\":{\"type\":\"linear\"},\"format\":{\"type\":\"default\",\"decimals\":null},\"aggregate\":\"sum\",\"formatType\":\"numberFormatFromNumberType\"},\"color\":{\"type\":\"nominal\",\"datum\":\"Salary\",\"scale\":{\"range\":[\"#2266D3\"],\"domain\":[\"Salary\"]}},\"xOffset\":{\"datum\":\"series_0\"}},\"transform\":[]}]}],\"resolve\":{\"scale\":{\"color\":\"independent\"}}}],\"title\":\"Salary by employee\",\"config\":{\"legend\":{\"disable\":false}},\"$schema\":\"https://vega.github.io/schema/vega-lite/v5.json\",\"encoding\":{},\"usermeta\":{\"seriesNames\":[\"Salary\"],\"seriesOrder\":[0],\"specSchemaVersion\":2,\"tooltipDefaultMode\":true}}\"\"\", **({'attach_selection': True} if 'attach_selection' in inspect.signature(_dntk.DeepnoteChart).parameters else {}), **({'filters': '[]'} if 'filters' in inspect.signature(_dntk.DeepnoteChart).parameters else {}))", + "block_group": "93602502de714543949d62c94101c476", + "execution_count": 3, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "4792b856d35b40c3ac4ecc880513ba67", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Big number", + "block_group": "d9c55e56e13745019ff43bad8b94ca6c" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "ea65eb57", + "execution_start": 1758017230260, + "execution_millis": 1, + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_big_number_title": "Max salary", + "deepnote_big_number_value": "salary_max", + "deepnote_big_number_format": "currency", + "deepnote_big_number_comparison_type": "", + "deepnote_big_number_comparison_title": "Difference with min", + "deepnote_big_number_comparison_value": "salary_min", + "deepnote_big_number_comparison_format": "", + "deepnote_big_number_comparison_enabled": true, + "cell_id": "63bd93dd0c7b4940bb7e2f281ef527ea", + "deepnote_cell_type": "big-number" + }, + "source": "\ndef __deepnote_big_number__():\n import json\n import jinja2\n from jinja2 import meta\n\n def render_template(template):\n parsed_content = jinja2.Environment().parse(template)\n\n required_variables = meta.find_undeclared_variables(parsed_content)\n\n context = {\n variable_name: globals().get(variable_name)\n for variable_name in required_variables\n }\n\n result = jinja2.Environment().from_string(template).render(context)\n\n return result\n\n rendered_title = render_template(\"Max salary\")\n rendered_comparison_title = render_template(\"Difference with min\")\n\n return json.dumps({\n \"comparisonTitle\": rendered_comparison_title,\n \"comparisonValue\": f\"{salary_min}\",\n \"title\": rendered_title,\n \"value\": f\"{salary_max}\"\n })\n\n__deepnote_big_number__()\n", + "block_group": "69a7615d8fec4e018ad29df4f7c9c8a6", + "execution_count": 4, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "b4ef3456ab3541d59c32127a4ec3623a", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Text input", + "block_group": "9300674080aa47178c3e80f9603bf522" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "73002490", + "execution_start": 1758017230310, + "execution_millis": 0, + "deepnote_input_label": "Text input display name", + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "text_input", + "deepnote_variable_value": "", + "deepnote_variable_default_value": "Some text input value", + "cell_id": "9617772dd620494588d82ff362f8723b", + "deepnote_cell_type": "input-text" + }, + "source": "text_input = ''", + "block_group": "cde392347c26426286cecd44eb7cc80e", + "execution_count": 5, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "d68f1407519648cf9352322a78706262", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Text area input", + "block_group": "843434fa29fb4926ac8e7d2c8708b683" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "dc8f2258", + "execution_start": 1758017230360, + "execution_millis": 0, + "deepnote_input_label": "Text area input", + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "text_area_input", + "deepnote_variable_value": "", + "deepnote_variable_default_value": "Some text area value", + "cell_id": "78b702ad9e4249c6a734e6540fd6d594", + "deepnote_cell_type": "input-textarea" + }, + "source": "text_area_input = ''", + "block_group": "0fbadd030dc44a55abdaba6c519a192c", + "execution_count": 6, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "6b4cf64deb7e4889a12ff8224f403e6e", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Select input", + "block_group": "4d3f0ded61ae433f943e667f6aa0acac" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "f30613eb", + "execution_start": 1758017230410, + "execution_millis": 0, + "deepnote_input_label": "Select input display name", + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "select_input", + "deepnote_variable_value": "Option 1", + "deepnote_variable_options": [ + "Option 1", + "Option 2" + ], + "deepnote_variable_select_type": "from-options", + "deepnote_variable_default_value": "Option 1", + "deepnote_variable_custom_options": [ + "Option 1", + "Option 2" + ], + "deepnote_variable_selected_variable": "", + "cell_id": "ad0dc815587c414e8350b7b2c277f526", + "deepnote_cell_type": "input-select" + }, + "source": "select_input = 'Option 1'", + "block_group": "8e1b14cb668a4a639812149ca1b076f0", + "execution_count": 7, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "d71623200b3a4139b78a3f64f11d1fee", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Slider input", + "block_group": "eeb937709b734d4ebfb10057b4f14427" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "903ebe60", + "execution_start": 1758017230460, + "execution_millis": 0, + "deepnote_input_label": "Slider input display name", + "deepnote_slider_step": 1, + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "slider_input", + "deepnote_variable_value": "5", + "deepnote_slider_max_value": 10, + "deepnote_slider_min_value": 0, + "deepnote_variable_default_value": "7", + "cell_id": "f5bde14ac91b4c619d4721119f6dc097", + "deepnote_cell_type": "input-slider" + }, + "source": "slider_input = 5", + "block_group": "ce9d87717518498a8e258cd7ca4c530c", + "execution_count": 8, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "1025124c6e2d423db37f1a2801d919c8", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Checkbox input", + "block_group": "0055729453894afa9c2a918ae9e4ad5d" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "43d96aab", + "execution_start": 1758017230510, + "execution_millis": 0, + "deepnote_input_label": "Checkbox input display name", + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "checkbox_input", + "deepnote_variable_value": false, + "deepnote_input_checkbox_label": "Checkbox label", + "deepnote_variable_default_value": true, + "cell_id": "2b8c96e18b9047e1abdbc1030e64e483", + "deepnote_cell_type": "input-checkbox" + }, + "source": "checkbox_input = False", + "block_group": "b33c667b572f4a8a981b26f3153fd113", + "execution_count": 9, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "5574b42d69b84dd485a5af45eed8ed24", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Date input", + "block_group": "997c3f11880641fcafd4e5d189f399c5" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "5506e6cf", + "execution_start": 1758101400493, + "execution_millis": 1, + "deepnote_input_label": "Date input display name", + "execution_context_id": "c8ddf739-5e27-4b0f-a7a1-6f638a515fbc", + "deepnote_variable_name": "date_input", + "deepnote_variable_value": "2025-09-16T00:00:00.000Z", + "deepnote_input_date_version": 2, + "deepnote_variable_default_value": "2025-08-27T00:00:00.000Z", + "cell_id": "da864431beb24d7ea254caf07469b64f", + "deepnote_cell_type": "input-date" + }, + "source": "\nfrom dateutil.parser import parse as _deepnote_parse\ndate_input = _deepnote_parse('2025-09-16T00:00:00.000Z').date()\n", + "block_group": "76b2a29b9fbb43b88987d605df82c196", + "execution_count": 1, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "453586f33cff44b8817b90f8fe96bb7c", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Date range input", + "block_group": "7bb4afb3b9e64ad9ac641040fae0f39f" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "df64ed1d", + "execution_start": 1758017230610, + "execution_millis": 0, + "deepnote_input_label": "Date range input display name", + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "date_range_input", + "deepnote_variable_value": "", + "deepnote_variable_default_value": [ + "2025-08-12", + "2025-08-14" + ], + "cell_id": "c0d58153fea24d749787d145a7184a95", + "deepnote_cell_type": "input-date-range" + }, + "source": "date_range_input = [None, None]", + "block_group": "adb47271070b4ec5bd7ae36b6374ed8c", + "execution_count": 11, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "067e15e2da45411996f2596f0b771bc2", + "deepnote_cell_type": "text-cell-p" + }, + "source": "File input", + "block_group": "f0729b0fd20546cfa27eb6cec10cd15a" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "2a21d71e", + "execution_start": 1758017230660, + "execution_millis": 0, + "deepnote_input_label": "File input display name", + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "file_input", + "deepnote_variable_value": "file_input_uploads/user_events_mini.csv", + "deepnote_allowed_file_extensions": ".csv", + "cell_id": "4aaf723a72644849aeac5850a31899a0", + "deepnote_cell_type": "input-file" + }, + "source": "file_input = 'file_input_uploads/user_events_mini.csv'", + "block_group": "476d14d4916b408394563233abaf8b41", + "execution_count": 12, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "07b4d5b4d6974ee2bc1ba0cebc222756", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Button", + "block_group": "dca7628f959e4975abe29417fbb585e8" + }, + { + "cell_type": "markdown", + "metadata": { + "source_hash": "25dd0fc7", + "execution_start": 1758017230710, + "execution_millis": 0, + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_button_title": "Set variable", + "deepnote_variable_name": "button_input_set_variable", + "deepnote_button_behavior": "set_variable", + "deepnote_button_color_scheme": "blue", + "cell_id": "a697f0202b9a4c67a4cb7120efef8867", + "deepnote_cell_type": "button" + }, + "source": "button_input_set_variable = False", + "block_group": "82e1707478464399abb956e9fdddda46", + "execution_count": null, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "source_hash": "b623e53d", + "execution_start": 1758017230760, + "execution_millis": 0, + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_button_title": "Run notebook", + "deepnote_variable_name": "button_1", + "deepnote_button_behavior": "run", + "deepnote_button_color_scheme": "blue", + "cell_id": "8b4935f7cefe4d819cad51b66c93fd79", + "deepnote_cell_type": "button" + }, + "source": "", + "block_group": "2c8494b7dec74944bacc78a7b584bb79", + "execution_count": null, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "0a334a952e274c2e915002636375b331", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Module", + "block_group": "44cdb835e3484a36b8e319e0a019b6da" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "b63b0b2e", + "execution_start": 1758017517949, + "execution_millis": 145407, + "execution_context_id": "f5da58fe-0dad-4318-867a-0ab9925d7c28", + "function_notebook_id": "e960b15d27074d38a6b07ff87eb42c89", + "function_notebook_inputs": {}, + "last_function_run_started_at": 1758017655789, + "function_notebook_export_mappings": { + "Monthly_signups": { + "enabled": true, + "variable_name": "Monthly_signups" + } + }, + "last_executed_function_notebook_id": "e960b15d27074d38a6b07ff87eb42c89", + "cell_id": "8e613308b24f419eb550573eda2602ab", + "deepnote_cell_type": "notebook-function" + }, + "source": "def _deepnote_run_notebook_function(export_table_states_json):\n globals()['_deepnote_run_notebook_function'] = None\n\n return _dntk.run_notebook_function(\n scope=globals(),\n function_notebook_id='e960b15d27074d38a6b07ff87eb42c89',\n inputs={},\n export_mappings={'Monthly_signups': {'enabled': True,'variable_name': 'Monthly_signups'}},\n export_table_states_json=export_table_states_json,\n notebook_function_api_token='',\n parent_notebook_function_run_id=None,\n debug=False\n )", + "block_group": "15846815e8f743f582176f114aaf799f", + "execution_count": 1, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "source": "\nCreated in deepnote.com \nCreated in Deepnote", + "metadata": { + "created_in_deepnote_cell": true, + "deepnote_cell_type": "markdown" + } + } + ], + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "deepnote_persisted_session": { + "createdAt": "2025-09-16T12:15:01.925Z" + }, + "deepnote_notebook_id": "686ad8158f6947f9b2796fb1add22277" + } +} diff --git a/all-block-types-with-outputs.deepnote b/all-block-types-with-outputs.deepnote new file mode 100644 index 0000000..cec4ea6 --- /dev/null +++ b/all-block-types-with-outputs.deepnote @@ -0,0 +1,1623 @@ +metadata: + createdAt: 2025-09-16T10:11:17.611Z + modifiedAt: 2025-09-16T10:13:03.273Z +project: + id: c4604eab-9672-4d68-ab40-4c27af41fbc7 + name: All block types + notebooks: + - blocks: + - content: Code + id: f6359663a8984338a1b2c4cfd0d4c171 + metadata: + formattedRanges: [] + sortingKey: a0 + type: text-cell-p + - content: |- + import pandas as pd + import numpy as np + + # Create sample data + data = { + 'Name': ['John', 'Emma', 'Michael', 'Sarah', 'David'], + 'Age': [28, 34, 42, 25, 31], + 'Salary': [65000, 78000, 95000, 62000, 70000], + 'Department': ['IT', 'HR', 'Finance', 'Marketing', 'IT'], + 'Experience': [3, 7, 12, 2, 5] + } + + # Create DataFrame + df = pd.DataFrame(data) + + # Create salary_max variable + salary_max = df['Salary'].max() + + # Create salary_min variable + salary_min = df['Salary'].min() + + # Display the DataFrame + df + executionCount: 1 + id: 347b6e16651c453881cf75a0c7365618 + metadata: + execution_start: 1758017228976 + execution_millis: 13 + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + outputs: + - output_type: execute_result + execution_count: 1 + data: + application/vnd.deepnote.dataframe.v3+json: + column_count: 5 + columns: + - name: Name + dtype: object + stats: + unique_count: 5 + nan_count: 0 + min: null + max: null + histogram: null + categories: + - name: John + count: 1 + - name: Emma + count: 1 + - name: 3 others + count: 3 + - name: Age + dtype: int64 + stats: + unique_count: 5 + nan_count: 0 + min: "25" + max: "42" + histogram: + - bin_start: 25 + bin_end: 26.7 + count: 1 + - bin_start: 26.7 + bin_end: 28.4 + count: 1 + - bin_start: 28.4 + bin_end: 30.1 + count: 0 + - bin_start: 30.1 + bin_end: 31.8 + count: 1 + - bin_start: 31.8 + bin_end: 33.5 + count: 0 + - bin_start: 33.5 + bin_end: 35.2 + count: 1 + - bin_start: 35.2 + bin_end: 36.9 + count: 0 + - bin_start: 36.9 + bin_end: 38.6 + count: 0 + - bin_start: 38.6 + bin_end: 40.3 + count: 0 + - bin_start: 40.3 + bin_end: 42 + count: 1 + categories: null + - name: Salary + dtype: int64 + stats: + unique_count: 5 + nan_count: 0 + min: "62000" + max: "95000" + histogram: + - bin_start: 62000 + bin_end: 65300 + count: 2 + - bin_start: 65300 + bin_end: 68600 + count: 0 + - bin_start: 68600 + bin_end: 71900 + count: 1 + - bin_start: 71900 + bin_end: 75200 + count: 0 + - bin_start: 75200 + bin_end: 78500 + count: 1 + - bin_start: 78500 + bin_end: 81800 + count: 0 + - bin_start: 81800 + bin_end: 85100 + count: 0 + - bin_start: 85100 + bin_end: 88400 + count: 0 + - bin_start: 88400 + bin_end: 91700 + count: 0 + - bin_start: 91700 + bin_end: 95000 + count: 1 + categories: null + - name: Department + dtype: object + stats: + unique_count: 4 + nan_count: 0 + min: null + max: null + histogram: null + categories: + - name: IT + count: 2 + - name: HR + count: 1 + - name: 2 others + count: 2 + - name: Experience + dtype: int64 + stats: + unique_count: 5 + nan_count: 0 + min: "2" + max: "12" + histogram: + - bin_start: 2 + bin_end: 3 + count: 1 + - bin_start: 3 + bin_end: 4 + count: 1 + - bin_start: 4 + bin_end: 5 + count: 0 + - bin_start: 5 + bin_end: 6 + count: 1 + - bin_start: 6 + bin_end: 7 + count: 0 + - bin_start: 7 + bin_end: 8 + count: 1 + - bin_start: 8 + bin_end: 9 + count: 0 + - bin_start: 9 + bin_end: 10 + count: 0 + - bin_start: 10 + bin_end: 11 + count: 0 + - bin_start: 11 + bin_end: 12 + count: 1 + categories: null + - name: _deepnote_index_column + dtype: int64 + row_count: 5 + preview_row_count: 5 + rows: + - Name: John + Age: 28 + Salary: 65000 + Department: IT + Experience: 3 + _deepnote_index_column: 0 + - Name: Emma + Age: 34 + Salary: 78000 + Department: HR + Experience: 7 + _deepnote_index_column: 1 + - Name: Michael + Age: 42 + Salary: 95000 + Department: Finance + Experience: 12 + _deepnote_index_column: 2 + - Name: Sarah + Age: 25 + Salary: 62000 + Department: Marketing + Experience: 2 + _deepnote_index_column: 3 + - Name: David + Age: 31 + Salary: 70000 + Department: IT + Experience: 5 + _deepnote_index_column: 4 + type: dataframe + text/plain: |2- + Name Age Salary Department Experience + 0 John 28 65000 IT 3 + 1 Emma 34 78000 HR 7 + 2 Michael 42 95000 Finance 12 + 3 Sarah 25 62000 Marketing 2 + 4 David 31 70000 IT 5 + text/html: |- +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAgeSalaryDepartmentExperience
0John2865000IT3
1Emma3478000HR7
2Michael4295000Finance12
3Sarah2562000Marketing2
4David3170000IT5
+
+ metadata: {} + sortingKey: m + type: code + - content: Markdown + id: f8e64035510d4918a22bbac0bc997982 + metadata: + formattedRanges: [] + sortingKey: s + type: text-cell-p + - content: >- + # Markdown heading + + + Markdown body text with a [link](https://www.google.com) and a + **bold** word. + id: 73f558db2f114d50b4eca9ebbff82870 + metadata: {} + sortingKey: v + type: markdown + - content: Paragraph + id: 34aebdcb65d84cdba24cc6b0185beeba + metadata: + formattedRanges: [] + sortingKey: x + type: text-cell-p + - content: A paragraph of text + id: f0a69c045b0b4a47ac3a19ca2e04cad7 + metadata: + formattedRanges: [] + sortingKey: y + type: text-cell-p + - content: Heading 1 + id: 300cda58d0814c928dd3bfeb72965696 + metadata: + formattedRanges: [] + sortingKey: yU + type: text-cell-p + - content: Heading 1 + id: 1cf63fe584e6403bb1c646f6481ed1e1 + metadata: + formattedRanges: [] + sortingKey: yj + type: text-cell-h1 + - content: Heading 2 + id: b3aa9896fc6e4b97ba3eed8fdfb8995a + metadata: + formattedRanges: [] + sortingKey: yr + type: text-cell-p + - content: Heading 2 + id: 9ede33b832b14c7781888a2f778f6785 + metadata: + formattedRanges: [] + sortingKey: yv + type: text-cell-h2 + - content: Heading 3 + id: 1fdd93c5ff004dac896214c52c2111e9 + metadata: + formattedRanges: [] + sortingKey: yx + type: text-cell-p + - content: Heading 3 + id: 6514a011a46a4a149046d188ab0eb271 + metadata: + formattedRanges: [] + sortingKey: yy + type: text-cell-h3 + - content: Bulleted list + id: faa890e3bdc647039b735657ad0aefbf + metadata: + formattedRanges: [] + sortingKey: yyU + type: text-cell-p + - content: Bullet one + id: aec4ba3615954acaabdedf70f142c332 + metadata: + formattedRanges: [] + sortingKey: yyj + type: text-cell-bullet + - content: Bullet two + id: 9f9f6c22499645a0945b46ec2ab5998a + metadata: + formattedRanges: [] + sortingKey: yyr + type: text-cell-bullet + - content: Bullet three + id: 6a1360e12cf648078226ee019c87f483 + metadata: + formattedRanges: [] + sortingKey: yyv + type: text-cell-bullet + - content: To-do list + id: 54fea078b60b40caa7ed54d98b74c2f7 + metadata: + formattedRanges: [] + sortingKey: yyx + type: text-cell-p + - content: To-do item one + id: b8213fd33984429da8ab939a6cafe53f + metadata: + formattedRanges: [] + sortingKey: yyy + type: text-cell-todo + - content: To-do item two + id: 8757f7e24b824c6e8c1c2ee3e76e5e50 + metadata: + checked: false + formattedRanges: [] + sortingKey: yyyU + type: text-cell-todo + - content: To-do item three + id: 30cf5a1a68fc4579ae86a498ab916ab3 + metadata: + checked: false + formattedRanges: [] + sortingKey: yyyj + type: text-cell-todo + - content: Callout + id: b6729542fe4c47079a398657a66a75c3 + metadata: + formattedRanges: [] + sortingKey: yyyr + type: text-cell-p + - content: A callout with some text + id: b3dc04fdfc9c4571be3a960e9674e3a1 + metadata: + formattedRanges: [] + sortingKey: yyyv + type: text-cell-callout + - content: Separator + id: 3cb803815f694153bbf763d4f82772f2 + metadata: + formattedRanges: [] + sortingKey: yyyx + type: text-cell-p + - content: "" + id: 091223f162044c2bab926c0f36a688e8 + metadata: {} + sortingKey: yyyy + type: separator + - content: SQL + id: de73a7dcfae44252acb9e92f46008bc1 + metadata: + formattedRanges: [] + sortingKey: yyyyU + type: text-cell-p + - content: SELECT * FROM df; + executionCount: 2 + id: 3cbce657e51247f2b01b730661260cb3 + metadata: + execution_start: 1758017229128 + execution_millis: 371 + sql_integration_id: deepnote-dataframe-sql + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: df + outputs: + - output_type: execute_result + execution_count: 2 + data: + application/vnd.deepnote.dataframe.v3+json: + column_count: 5 + columns: + - name: Name + dtype: object + stats: + unique_count: 5 + nan_count: 0 + min: null + max: null + histogram: null + categories: + - name: John + count: 1 + - name: Emma + count: 1 + - name: 3 others + count: 3 + - name: Age + dtype: int64 + stats: + unique_count: 5 + nan_count: 0 + min: "25" + max: "42" + histogram: + - bin_start: 25 + bin_end: 26.7 + count: 1 + - bin_start: 26.7 + bin_end: 28.4 + count: 1 + - bin_start: 28.4 + bin_end: 30.1 + count: 0 + - bin_start: 30.1 + bin_end: 31.8 + count: 1 + - bin_start: 31.8 + bin_end: 33.5 + count: 0 + - bin_start: 33.5 + bin_end: 35.2 + count: 1 + - bin_start: 35.2 + bin_end: 36.9 + count: 0 + - bin_start: 36.9 + bin_end: 38.6 + count: 0 + - bin_start: 38.6 + bin_end: 40.3 + count: 0 + - bin_start: 40.3 + bin_end: 42 + count: 1 + categories: null + - name: Salary + dtype: int64 + stats: + unique_count: 5 + nan_count: 0 + min: "62000" + max: "95000" + histogram: + - bin_start: 62000 + bin_end: 65300 + count: 2 + - bin_start: 65300 + bin_end: 68600 + count: 0 + - bin_start: 68600 + bin_end: 71900 + count: 1 + - bin_start: 71900 + bin_end: 75200 + count: 0 + - bin_start: 75200 + bin_end: 78500 + count: 1 + - bin_start: 78500 + bin_end: 81800 + count: 0 + - bin_start: 81800 + bin_end: 85100 + count: 0 + - bin_start: 85100 + bin_end: 88400 + count: 0 + - bin_start: 88400 + bin_end: 91700 + count: 0 + - bin_start: 91700 + bin_end: 95000 + count: 1 + categories: null + - name: Department + dtype: object + stats: + unique_count: 4 + nan_count: 0 + min: null + max: null + histogram: null + categories: + - name: IT + count: 2 + - name: HR + count: 1 + - name: 2 others + count: 2 + - name: Experience + dtype: int64 + stats: + unique_count: 5 + nan_count: 0 + min: "2" + max: "12" + histogram: + - bin_start: 2 + bin_end: 3 + count: 1 + - bin_start: 3 + bin_end: 4 + count: 1 + - bin_start: 4 + bin_end: 5 + count: 0 + - bin_start: 5 + bin_end: 6 + count: 1 + - bin_start: 6 + bin_end: 7 + count: 0 + - bin_start: 7 + bin_end: 8 + count: 1 + - bin_start: 8 + bin_end: 9 + count: 0 + - bin_start: 9 + bin_end: 10 + count: 0 + - bin_start: 10 + bin_end: 11 + count: 0 + - bin_start: 11 + bin_end: 12 + count: 1 + categories: null + - name: _deepnote_index_column + dtype: int64 + row_count: 5 + preview_row_count: 5 + rows: + - Name: John + Age: 28 + Salary: 65000 + Department: IT + Experience: 3 + _deepnote_index_column: 0 + - Name: Emma + Age: 34 + Salary: 78000 + Department: HR + Experience: 7 + _deepnote_index_column: 1 + - Name: Michael + Age: 42 + Salary: 95000 + Department: Finance + Experience: 12 + _deepnote_index_column: 2 + - Name: Sarah + Age: 25 + Salary: 62000 + Department: Marketing + Experience: 2 + _deepnote_index_column: 3 + - Name: David + Age: 31 + Salary: 70000 + Department: IT + Experience: 5 + _deepnote_index_column: 4 + type: dataframe + text/plain: |2- + Name Age Salary Department Experience + 0 John 28 65000 IT 3 + 1 Emma 34 78000 HR 7 + 2 Michael 42 95000 Finance 12 + 3 Sarah 25 62000 Marketing 2 + 4 David 31 70000 IT 5 + text/html: |- +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAgeSalaryDepartmentExperience
0John2865000IT3
1Emma3478000HR7
2Michael4295000Finance12
3Sarah2562000Marketing2
4David3170000IT5
+
+ metadata: {} + sortingKey: yyyyj + type: sql + - content: Chat + id: b4d48a1639bc4a8b83a7b4000085a862 + metadata: + formattedRanges: [] + sortingKey: yyyyr + type: text-cell-p + - content: "" + executionCount: 3 + id: 157db3d3f69845be87d3eee17eb677fe + metadata: + execution_start: 1758017230093 + execution_millis: 125 + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: df + deepnote_visualization_spec: + layer: + - layer: + - layer: + - mark: + clip: true + type: bar + color: "#2266D3" + tooltip: true + encoding: + x: + axis: + title: Employee name + sort: null + type: nominal + field: Name + scale: + type: linear + y: + axis: + title: Salary + format: + type: number + decimals: null + formatType: numberFormatFromNumberType + type: quantitative + field: Salary + scale: + type: linear + format: + type: default + decimals: null + aggregate: sum + formatType: numberFormatFromNumberType + color: + type: nominal + datum: Salary + scale: + range: + - "#2266D3" + domain: + - Salary + xOffset: + datum: series_0 + transform: [] + resolve: + scale: + color: independent + title: Salary by employee + config: + legend: + disable: false + $schema: https://vega.github.io/schema/vega-lite/v5.json + encoding: {} + usermeta: + seriesNames: + - Salary + seriesOrder: + - 0 + specSchemaVersion: 2 + tooltipDefaultMode: true + outputs: + - output_type: execute_result + execution_count: 3 + data: + application/vnd.vega.v5+json: + $schema: https://vega.github.io/schema/vega/v5.json + data: + - name: legend_size_0_store + - name: legend_color_0_store + - name: interval_selection_store + - name: source_0 + values: + - Name: John + sum_Salary: 65000 + - Name: Emma + sum_Salary: 78000 + - Name: Michael + sum_Salary: 95000 + - Name: Sarah + sum_Salary: 62000 + - Name: David + sum_Salary: 70000 + - name: source_0_x_domain_Name + values: + - Name: John + - Name: Emma + - Name: Michael + - Name: Sarah + - Name: David + - name: source_0_y_domain_sum_Salary + values: + - min: 62000 + max: 95000 + signals: + - name: width + init: "isFinite(containerSize()[0]) ? containerSize()[0] : 200" + on: + - events: window:resize + update: "isFinite(containerSize()[0]) ? containerSize()[0] : 200" + - name: height + init: "isFinite(containerSize()[1]) ? containerSize()[1] : 200" + on: + - events: window:resize + update: "isFinite(containerSize()[1]) ? containerSize()[1] : 200" + - name: unit + value: {} + on: + - events: pointermove + update: "isTuple(group()) ? group() : unit" + - name: legend_size_0 + update: vlSelectionResolve("legend_size_0_store", "union", true, true) + - name: legend_color_0 + update: vlSelectionResolve("legend_color_0_store", "union", true, true) + - name: interval_selection + update: vlSelectionResolve("interval_selection_store", "union") + - name: legend_size_0_tuple + on: + - events: + - source: scope + type: click + update: "datum && item().mark.marktype !== 'group' && indexof(item().mark.role, + 'legend') < 0 && indexof(item().mark.name, + 'interval_selection_brush') < 0 ? {unit: + \"layer_0_layer_0_layer_0\", fields: + legend_size_0_tuple_fields, values: []} : null" + force: true + - events: + - source: view + type: dblclick + update: "null" + - name: legend_size_0_tuple_fields + value: [] + - name: legend_size_0_toggle + value: false + on: + - events: + - source: scope + type: click + update: "true" + - events: + - source: view + type: dblclick + update: "false" + - name: legend_size_0_modify + on: + - events: + signal: legend_size_0_tuple + update: 'modify("legend_size_0_store", legend_size_0_toggle ? null : + legend_size_0_tuple, legend_size_0_toggle ? null : + true, legend_size_0_toggle ? legend_size_0_tuple : + null)' + - name: legend_color_0_tuple + on: + - events: + - source: scope + type: click + update: "datum && item().mark.marktype !== 'group' && indexof(item().mark.role, + 'legend') < 0 && indexof(item().mark.name, + 'interval_selection_brush') < 0 ? {unit: + \"layer_0_layer_0_layer_0\", fields: + legend_color_0_tuple_fields, values: []} : null" + force: true + - events: + - source: view + type: dblclick + update: "null" + - name: legend_color_0_tuple_fields + value: [] + - name: legend_color_0_toggle + value: false + on: + - events: + - source: scope + type: click + update: "true" + - events: + - source: view + type: dblclick + update: "false" + - name: legend_color_0_modify + on: + - events: + signal: legend_color_0_tuple + update: 'modify("legend_color_0_store", legend_color_0_toggle ? null : + legend_color_0_tuple, legend_color_0_toggle ? null : + true, legend_color_0_toggle ? legend_color_0_tuple : + null)' + - name: interval_selection_x + value: [] + on: + - events: + source: scope + filter: + - '!event.item || event.item.mark.name !== + "interval_selection_brush"' + type: pointerdown + update: "[x(unit), x(unit)]" + - events: + source: window + between: + - source: scope + filter: + - '!event.item || event.item.mark.name !== + "interval_selection_brush"' + type: pointerdown + - source: window + type: pointerup + type: pointermove + consume: true + update: "[interval_selection_x[0], clamp(x(unit), 0, width)]" + - events: + signal: interval_selection_scale_trigger + update: "[0, 0]" + - events: + - source: view + type: dblclick + update: "[0, 0]" + - events: + signal: interval_selection_translate_delta + update: clampRange(panLinear(interval_selection_translate_anchor.extent_x, + interval_selection_translate_delta.x / + span(interval_selection_translate_anchor.extent_x)), + 0, width) + - events: + signal: interval_selection_zoom_delta + update: clampRange(zoomLinear(interval_selection_x, + interval_selection_zoom_anchor.x, + interval_selection_zoom_delta), 0, width) + - name: interval_selection_Name + on: + - events: + signal: interval_selection_x + update: 'interval_selection_x[0] === interval_selection_x[1] ? null : + invert("x", interval_selection_x)' + - name: interval_selection_scale_trigger + value: {} + on: + - events: + - scale: x + update: '(!isArray(interval_selection_Name) || (invert("x", + interval_selection_x)[0] === + interval_selection_Name[0] && invert("x", + interval_selection_x)[1] === + interval_selection_Name[1])) ? + interval_selection_scale_trigger : {}' + - name: interval_selection_tuple + on: + - events: + - signal: interval_selection_Name + update: 'interval_selection_Name ? {unit: "layer_0_layer_0_layer_0", fields: + interval_selection_tuple_fields, values: + [interval_selection_Name]} : null' + - name: interval_selection_tuple_fields + value: + - field: Name + channel: x + type: E + - name: interval_selection_translate_anchor + value: {} + on: + - events: + - source: scope + markname: interval_selection_brush + type: pointerdown + update: "{x: x(unit), y: y(unit), extent_x: slice(interval_selection_x)}" + - name: interval_selection_translate_delta + value: {} + on: + - events: + - source: window + between: + - source: scope + markname: interval_selection_brush + type: pointerdown + - source: window + type: pointerup + consume: true + type: pointermove + update: "{x: interval_selection_translate_anchor.x - x(unit), y: + interval_selection_translate_anchor.y - y(unit)}" + - name: interval_selection_zoom_anchor + on: + - events: + - source: scope + markname: interval_selection_brush + type: wheel + consume: true + update: "{x: x(unit), y: y(unit)}" + - name: interval_selection_zoom_delta + on: + - events: + - source: scope + markname: interval_selection_brush + type: wheel + consume: true + update: pow(1.001, event.deltaY * pow(16, event.deltaMode)) + force: true + - name: interval_selection_modify + on: + - events: + signal: interval_selection_tuple + update: modify("interval_selection_store", interval_selection_tuple, true) + marks: + - type: rect + name: interval_selection_brush_bg + encode: + enter: + fillOpacity: + value: 0.125 + fill: + value: "#333" + update: + y: + - value: 0 + test: data("interval_selection_store").length && + data("interval_selection_store")[0].unit === + "layer_0_layer_0_layer_0" + - value: 0 + x: + - signal: interval_selection_x[0] + test: data("interval_selection_store").length && + data("interval_selection_store")[0].unit === + "layer_0_layer_0_layer_0" + - value: 0 + x2: + - signal: interval_selection_x[1] + test: data("interval_selection_store").length && + data("interval_selection_store")[0].unit === + "layer_0_layer_0_layer_0" + - value: 0 + y2: + - field: + signal: null + datum: null + group: height + parent: null + test: data("interval_selection_store").length && + data("interval_selection_store")[0].unit === + "layer_0_layer_0_layer_0" + - value: 0 + clip: true + - type: rect + name: layer_0_layer_0_layer_0_marks + from: + data: source_0 + encode: + update: + fill: + value: Salary + scale: layer_0_layer_0_color + opacity: + - value: 1 + test: (!length(data("legend_size_0_store")) || + vlSelectionTest("legend_size_0_store", datum)) + && (!length(data("legend_color_0_store")) || + vlSelectionTest("legend_color_0_store", datum)) + && (!length(data("interval_selection_store")) || + vlSelectionTest("interval_selection_store", + datum)) + - value: 0.2 + width: + signal: max(0.25, bandwidth('xOffset')) + y: + field: sum_Salary + scale: y + y2: + value: 0 + scale: y + x: + field: Name + scale: x + offset: + value: series_0 + scale: xOffset + tooltip: + signal: '{"Name": isValid(datum["Name"]) ? datum["Name"] : ""+datum["Name"], + "Sum of Salary": + numberFormatFromNumberType(datum["sum_Salary"], + {"decimals":null,"type":"default"})}' + style: + - bar + interactive: true + clip: true + - type: rect + name: interval_selection_brush + encode: + enter: + cursor: + value: move + fill: + value: transparent + update: + y2: + - field: + signal: null + datum: null + group: height + parent: null + test: data("interval_selection_store").length && + data("interval_selection_store")[0].unit === + "layer_0_layer_0_layer_0" + - value: 0 + y: + - value: 0 + test: data("interval_selection_store").length && + data("interval_selection_store")[0].unit === + "layer_0_layer_0_layer_0" + - value: 0 + x2: + - signal: interval_selection_x[1] + test: data("interval_selection_store").length && + data("interval_selection_store")[0].unit === + "layer_0_layer_0_layer_0" + - value: 0 + stroke: + - value: white + test: interval_selection_x[0] !== interval_selection_x[1] + - {} + x: + - signal: interval_selection_x[0] + test: data("interval_selection_store").length && + data("interval_selection_store")[0].unit === + "layer_0_layer_0_layer_0" + - value: 0 + clip: true + scales: + - name: x + type: band + domain: + data: source_0_x_domain_Name + field: Name + range: + - 0 + - signal: width + paddingOuter: 0.2 + paddingInner: 0.2 + - name: y + type: linear + domain: + - signal: (data("source_0_y_domain_sum_Salary")[0] || {}).min + - signal: (data("source_0_y_domain_sum_Salary")[0] || {}).max + range: + - signal: height + - 0 + nice: true + zero: true + - name: xOffset + type: band + domain: + - series_0 + range: + - 0 + - signal: bandwidth('x') + - name: layer_0_layer_0_color + type: ordinal + domain: + - Salary + range: + - "#2266D3" + axes: + - scale: y + zindex: 0 + ticks: false + gridScale: x + labels: false + grid: true + tickCount: 5 + domain: false + orient: left + aria: false + maxExtent: 0 + minExtent: 0 + - scale: x + labelAngle: 270 + orient: bottom + zindex: 0 + title: Employee name + grid: false + labelAlign: right + labelBaseline: middle + - scale: y + labelOverlap: true + zindex: 0 + encode: + labels: + update: + text: + signal: numberFormatFromNumberType(datum.value, + {"decimals":null,"type":"number"}) + orient: left + tickCount: 5 + grid: false + title: Salary + title: + text: Salary by employee + frame: group + usermeta: + tooltipDefaultMode: true + seriesNames: + - Salary + seriesOrder: + - 0 + specSchemaVersion: 2 + outputMetadata: + rowLimitExceeded: false + rowLimit: 5000 + filteredDataframeSize: 5 + columns: + - name: Name + nativeType: object + distinctValues: + - David + - Emma + - John + - Michael + - Sarah + - name: Age + nativeType: int64 + distinctValues: + - 25 + - 28 + - 31 + - 34 + - 42 + - name: Salary + nativeType: int64 + distinctValues: + - 62000 + - 65000 + - 70000 + - 78000 + - 95000 + - name: Department + nativeType: object + distinctValues: + - Finance + - HR + - IT + - Marketing + - name: Experience + nativeType: int64 + distinctValues: + - 2 + - 3 + - 5 + - 7 + - 12 + background: white + legends: + - fill: layer_0_layer_0_color + symbolType: square + encode: + symbols: + update: + opacity: + value: 1 + style: cell + config: + customFormatTypes: true + legend: + disable: false + autosize: + type: fit + contains: padding + padding: 5 + text/plain: + metadata: {} + sortingKey: yyyyv + type: visualization + - content: Big number + id: 4792b856d35b40c3ac4ecc880513ba67 + metadata: + formattedRanges: [] + sortingKey: yyyyx + type: text-cell-p + - content: > + + def __deepnote_big_number__(): + import json + import jinja2 + from jinja2 import meta + + def render_template(template): + parsed_content = jinja2.Environment().parse(template) + + required_variables = meta.find_undeclared_variables(parsed_content) + + context = { + variable_name: globals().get(variable_name) + for variable_name in required_variables + } + + result = jinja2.Environment().from_string(template).render(context) + + return result + + rendered_title = render_template("Max salary") + rendered_comparison_title = render_template("Difference with min") + + return json.dumps({ + "comparisonTitle": rendered_comparison_title, + "comparisonValue": f"{salary_min}", + "title": rendered_title, + "value": f"{salary_max}" + }) + + __deepnote_big_number__() + executionCount: 4 + id: 63bd93dd0c7b4940bb7e2f281ef527ea + metadata: + execution_start: 1758017230260 + execution_millis: 1 + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_big_number_title: Max salary + deepnote_big_number_value: salary_max + deepnote_big_number_format: currency + deepnote_big_number_comparison_type: "" + deepnote_big_number_comparison_title: Difference with min + deepnote_big_number_comparison_value: salary_min + deepnote_big_number_comparison_format: "" + deepnote_big_number_comparison_enabled: true + outputs: + - output_type: execute_result + execution_count: 4 + data: + text/plain: "'{\"comparisonTitle\": \"Difference with min\", + \"comparisonValue\": \"62000\", \"title\": \"Max salary\", + \"value\": \"95000\"}'" + metadata: {} + sortingKey: yyyyy + type: big-number + - content: Text input + id: b4ef3456ab3541d59c32127a4ec3623a + metadata: + formattedRanges: [] + sortingKey: yyyyyU + type: text-cell-p + - content: text_input = '' + executionCount: 5 + id: 9617772dd620494588d82ff362f8723b + metadata: + execution_start: 1758017230310 + execution_millis: 0 + deepnote_input_label: Text input display name + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: text_input + deepnote_variable_value: "" + deepnote_variable_default_value: Some text input value + outputs: [] + sortingKey: yyyyyj + type: input-text + - content: Text area input + id: d68f1407519648cf9352322a78706262 + metadata: + formattedRanges: [] + sortingKey: yyyyyr + type: text-cell-p + - content: text_area_input = '' + executionCount: 6 + id: 78b702ad9e4249c6a734e6540fd6d594 + metadata: + execution_start: 1758017230360 + execution_millis: 0 + deepnote_input_label: Text area input + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: text_area_input + deepnote_variable_value: "" + deepnote_variable_default_value: Some text area value + outputs: [] + sortingKey: yyyyyv + type: input-textarea + - content: Select input + id: 6b4cf64deb7e4889a12ff8224f403e6e + metadata: + formattedRanges: [] + sortingKey: yyyyyx + type: text-cell-p + - content: select_input = 'Option 1' + executionCount: 7 + id: ad0dc815587c414e8350b7b2c277f526 + metadata: + execution_start: 1758017230410 + execution_millis: 0 + deepnote_input_label: Select input display name + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: select_input + deepnote_variable_value: Option 1 + deepnote_variable_options: + - Option 1 + - Option 2 + deepnote_variable_select_type: from-options + deepnote_variable_default_value: Option 1 + deepnote_variable_custom_options: + - Option 1 + - Option 2 + deepnote_variable_selected_variable: "" + outputs: [] + sortingKey: yyyyyy + type: input-select + - content: Slider input + id: d71623200b3a4139b78a3f64f11d1fee + metadata: + formattedRanges: [] + sortingKey: yyyyyyU + type: text-cell-p + - content: slider_input = 5 + executionCount: 8 + id: f5bde14ac91b4c619d4721119f6dc097 + metadata: + execution_start: 1758017230460 + execution_millis: 0 + deepnote_input_label: Slider input display name + deepnote_slider_step: 1 + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: slider_input + deepnote_variable_value: "5" + deepnote_slider_max_value: 10 + deepnote_slider_min_value: 0 + deepnote_variable_default_value: "7" + outputs: [] + sortingKey: yyyyyyj + type: input-slider + - content: Checkbox input + id: 1025124c6e2d423db37f1a2801d919c8 + metadata: + formattedRanges: [] + sortingKey: yyyyyyr + type: text-cell-p + - content: checkbox_input = False + executionCount: 9 + id: 2b8c96e18b9047e1abdbc1030e64e483 + metadata: + execution_start: 1758017230510 + execution_millis: 0 + deepnote_input_label: Checkbox input display name + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: checkbox_input + deepnote_variable_value: false + deepnote_input_checkbox_label: Checkbox label + deepnote_variable_default_value: true + outputs: [] + sortingKey: yyyyyyv + type: input-checkbox + - content: Date input + id: 5574b42d69b84dd485a5af45eed8ed24 + metadata: + formattedRanges: [] + sortingKey: yyyyyyx + type: text-cell-p + - content: | + + from dateutil.parser import parse as _deepnote_parse + date_input = _deepnote_parse('2025-09-16T00:00:00.000Z').date() + executionCount: 10 + id: da864431beb24d7ea254caf07469b64f + metadata: + execution_start: 1758017230560 + execution_millis: 0 + deepnote_input_label: Date input display name + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: date_input + deepnote_variable_value: 2025-09-16T00:00:00.000Z + deepnote_input_date_version: 2 + deepnote_variable_default_value: 2025-08-27T00:00:00.000Z + outputs: [] + sortingKey: yyyyyyy + type: input-date + - content: Date range input + id: 453586f33cff44b8817b90f8fe96bb7c + metadata: + formattedRanges: [] + sortingKey: yyyyyyyU + type: text-cell-p + - content: date_range_input = [None, None] + executionCount: 11 + id: c0d58153fea24d749787d145a7184a95 + metadata: + execution_start: 1758017230610 + execution_millis: 0 + deepnote_input_label: Date range input display name + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: date_range_input + deepnote_variable_value: "" + deepnote_variable_default_value: + - 2025-08-12 + - 2025-08-14 + outputs: [] + sortingKey: yyyyyyyj + type: input-date-range + - content: File input + id: 067e15e2da45411996f2596f0b771bc2 + metadata: + formattedRanges: [] + sortingKey: yyyyyyyr + type: text-cell-p + - content: file_input = 'file_input_uploads/user_events_mini.csv' + executionCount: 12 + id: 4aaf723a72644849aeac5850a31899a0 + metadata: + execution_start: 1758017230660 + execution_millis: 0 + deepnote_input_label: File input display name + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_variable_name: file_input + deepnote_variable_value: file_input_uploads/user_events_mini.csv + deepnote_allowed_file_extensions: .csv + outputs: [] + sortingKey: yyyyyyyv + type: input-file + - content: Button + id: 07b4d5b4d6974ee2bc1ba0cebc222756 + metadata: + formattedRanges: [] + sortingKey: yyyyyyyx + type: text-cell-p + - content: "" + id: a697f0202b9a4c67a4cb7120efef8867 + metadata: + execution_start: 1758017230710 + execution_millis: 0 + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_button_title: Set variable + deepnote_variable_name: button_input_set_variable + deepnote_button_behavior: set_variable + deepnote_button_color_scheme: blue + outputs: [] + sortingKey: yyyyyyyy + type: button + - content: "" + id: 8b4935f7cefe4d819cad51b66c93fd79 + metadata: + execution_start: 1758017230760 + execution_millis: 0 + execution_context_id: 43d850b5-85c3-4bc8-b2d5-b50f2529e42c + deepnote_button_title: Run notebook + deepnote_variable_name: button_1 + deepnote_button_behavior: run + deepnote_button_color_scheme: blue + outputs: [] + sortingKey: yyyyyyyyU + type: button + - content: Module + id: 0a334a952e274c2e915002636375b331 + metadata: + formattedRanges: [] + sortingKey: yyyyyyyyj + type: text-cell-p + - content: "" + id: 8e613308b24f419eb550573eda2602ab + metadata: + execution_start: 1758017517949 + execution_millis: 4331 + execution_context_id: f5da58fe-0dad-4318-867a-0ab9925d7c28 + function_notebook_id: e960b15d27074d38a6b07ff87eb42c89 + function_notebook_inputs: {} + last_function_run_started_at: 1758017230910 + function_notebook_export_mappings: + Monthly_signups: + enabled: true + variable_name: Monthly_signups + last_executed_function_notebook_id: 704967b0680a4c15a30ba70ff8730844 + outputs: [] + sortingKey: yyyyyyyyr + type: notebook-function + executionMode: block + id: 686ad8158f6947f9b2796fb1add22277 + isModule: false + name: All block types + workingDirectory: / + settings: {} +version: 1.0.0 diff --git a/all-block-types-with-outputs.ipynb b/all-block-types-with-outputs.ipynb new file mode 100644 index 0000000..8376dc9 --- /dev/null +++ b/all-block-types-with-outputs.ipynb @@ -0,0 +1,2756 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "795370c73d4e4a7cbf8d04fb7e0e9da1", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Code", + "block_group": "a2621902d0a7472595a71e28f01bb3da" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "8a1ac92c", + "execution_start": 1758017228976, + "execution_millis": 13, + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "cell_id": "2bdc19557f234ba79d9b3d4135ad2aab", + "deepnote_cell_type": "code" + }, + "source": "import pandas as pd\nimport numpy as np\n\n# Create sample data\ndata = {\n 'Name': ['John', 'Emma', 'Michael', 'Sarah', 'David'],\n 'Age': [28, 34, 42, 25, 31],\n 'Salary': [65000, 78000, 95000, 62000, 70000],\n 'Department': ['IT', 'HR', 'Finance', 'Marketing', 'IT'],\n 'Experience': [3, 7, 12, 2, 5]\n}\n\n# Create DataFrame\ndf = pd.DataFrame(data)\n\n# Create salary_max variable\nsalary_max = df['Salary'].max()\n\n# Create salary_min variable\nsalary_min = df['Salary'].min()\n\n# Display the DataFrame\ndf", + "block_group": "2a432c3f8c6a4602a4299b5094cd1b35", + "execution_count": 1, + "outputs": [ + { + "output_type": "execute_result", + "execution_count": 1, + "data": { + "application/vnd.deepnote.dataframe.v3+json": { + "column_count": 5, + "columns": [ + { + "name": "Name", + "dtype": "object", + "stats": { + "unique_count": 5, + "nan_count": 0, + "min": null, + "max": null, + "histogram": null, + "categories": [ + { + "name": "John", + "count": 1 + }, + { + "name": "Emma", + "count": 1 + }, + { + "name": "3 others", + "count": 3 + } + ] + } + }, + { + "name": "Age", + "dtype": "int64", + "stats": { + "unique_count": 5, + "nan_count": 0, + "min": "25", + "max": "42", + "histogram": [ + { + "bin_start": 25, + "bin_end": 26.7, + "count": 1 + }, + { + "bin_start": 26.7, + "bin_end": 28.4, + "count": 1 + }, + { + "bin_start": 28.4, + "bin_end": 30.1, + "count": 0 + }, + { + "bin_start": 30.1, + "bin_end": 31.8, + "count": 1 + }, + { + "bin_start": 31.8, + "bin_end": 33.5, + "count": 0 + }, + { + "bin_start": 33.5, + "bin_end": 35.2, + "count": 1 + }, + { + "bin_start": 35.2, + "bin_end": 36.9, + "count": 0 + }, + { + "bin_start": 36.9, + "bin_end": 38.6, + "count": 0 + }, + { + "bin_start": 38.6, + "bin_end": 40.3, + "count": 0 + }, + { + "bin_start": 40.3, + "bin_end": 42, + "count": 1 + } + ], + "categories": null + } + }, + { + "name": "Salary", + "dtype": "int64", + "stats": { + "unique_count": 5, + "nan_count": 0, + "min": "62000", + "max": "95000", + "histogram": [ + { + "bin_start": 62000, + "bin_end": 65300, + "count": 2 + }, + { + "bin_start": 65300, + "bin_end": 68600, + "count": 0 + }, + { + "bin_start": 68600, + "bin_end": 71900, + "count": 1 + }, + { + "bin_start": 71900, + "bin_end": 75200, + "count": 0 + }, + { + "bin_start": 75200, + "bin_end": 78500, + "count": 1 + }, + { + "bin_start": 78500, + "bin_end": 81800, + "count": 0 + }, + { + "bin_start": 81800, + "bin_end": 85100, + "count": 0 + }, + { + "bin_start": 85100, + "bin_end": 88400, + "count": 0 + }, + { + "bin_start": 88400, + "bin_end": 91700, + "count": 0 + }, + { + "bin_start": 91700, + "bin_end": 95000, + "count": 1 + } + ], + "categories": null + } + }, + { + "name": "Department", + "dtype": "object", + "stats": { + "unique_count": 4, + "nan_count": 0, + "min": null, + "max": null, + "histogram": null, + "categories": [ + { + "name": "IT", + "count": 2 + }, + { + "name": "HR", + "count": 1 + }, + { + "name": "2 others", + "count": 2 + } + ] + } + }, + { + "name": "Experience", + "dtype": "int64", + "stats": { + "unique_count": 5, + "nan_count": 0, + "min": "2", + "max": "12", + "histogram": [ + { + "bin_start": 2, + "bin_end": 3, + "count": 1 + }, + { + "bin_start": 3, + "bin_end": 4, + "count": 1 + }, + { + "bin_start": 4, + "bin_end": 5, + "count": 0 + }, + { + "bin_start": 5, + "bin_end": 6, + "count": 1 + }, + { + "bin_start": 6, + "bin_end": 7, + "count": 0 + }, + { + "bin_start": 7, + "bin_end": 8, + "count": 1 + }, + { + "bin_start": 8, + "bin_end": 9, + "count": 0 + }, + { + "bin_start": 9, + "bin_end": 10, + "count": 0 + }, + { + "bin_start": 10, + "bin_end": 11, + "count": 0 + }, + { + "bin_start": 11, + "bin_end": 12, + "count": 1 + } + ], + "categories": null + } + }, + { + "name": "_deepnote_index_column", + "dtype": "int64" + } + ], + "row_count": 5, + "preview_row_count": 5, + "rows": [ + { + "Name": "John", + "Age": 28, + "Salary": 65000, + "Department": "IT", + "Experience": 3, + "_deepnote_index_column": 0 + }, + { + "Name": "Emma", + "Age": 34, + "Salary": 78000, + "Department": "HR", + "Experience": 7, + "_deepnote_index_column": 1 + }, + { + "Name": "Michael", + "Age": 42, + "Salary": 95000, + "Department": "Finance", + "Experience": 12, + "_deepnote_index_column": 2 + }, + { + "Name": "Sarah", + "Age": 25, + "Salary": 62000, + "Department": "Marketing", + "Experience": 2, + "_deepnote_index_column": 3 + }, + { + "Name": "David", + "Age": 31, + "Salary": 70000, + "Department": "IT", + "Experience": 5, + "_deepnote_index_column": 4 + } + ], + "type": "dataframe" + }, + "text/plain": " Name Age Salary Department Experience\n0 John 28 65000 IT 3\n1 Emma 34 78000 HR 7\n2 Michael 42 95000 Finance 12\n3 Sarah 25 62000 Marketing 2\n4 David 31 70000 IT 5", + "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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
NameAgeSalaryDepartmentExperience
0John2865000IT3
1Emma3478000HR7
2Michael4295000Finance12
3Sarah2562000Marketing2
4David3170000IT5
\n
" + }, + "metadata": {} + } + ], + "outputs_reference": "s3:deepnote-cell-outputs-production/59c52cca-d78f-474e-bfda-a251d7126c94", + "content_dependencies": { + "codeHash": "8a1ac92c", + "usedVariables": [ + "pd", + "data", + "df" + ], + "importedModules": [ + "pd", + "np" + ], + "definedVariables": [ + "data", + "salary_max", + "df", + "salary_min" + ] + } + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "4b03e4cf331b4024945fcf404152e291", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Markdown", + "block_group": "51672b4375be4e208ca0cb6d58ea17da" + }, + { + "cell_type": "markdown", + "metadata": { + "cell_id": "ade9381e1d3d40d886a3b6aa85139aeb", + "deepnote_cell_type": "markdown" + }, + "source": "# Markdown heading\n\nMarkdown body text with a [link](https://www.google.com) and a **bold** word.", + "block_group": "10a282b7984f4ad98f90ac490c9bed3c" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "808ec6b5e22c4cf0b4bfcb822569bbe4", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Paragraph", + "block_group": "7f88f5051e844b36a0cf97ddae05c9fc" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "301c2adcc04c4438a7a96e5df4820600", + "deepnote_cell_type": "text-cell-p" + }, + "source": "A paragraph of text", + "block_group": "af1ca519408e49a3b766ebc98d77db48" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "549589f5a8f947aab66b051132c020ce", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Heading 1", + "block_group": "550d948208fb4ced92d8600653be15b4" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "273122c8d85840a986a9b41671270359", + "deepnote_cell_type": "text-cell-h1" + }, + "source": "# Heading 1", + "block_group": "9a7f7bf77b3b45f6becf7ae73e6eee62" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "8e609412ab5547768a9dfc777ece75bc", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Heading 2", + "block_group": "ac657f5a4adf478ba1b76a03c9d9361a" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "5f5f63d954ea4f69812c4ecd142e0f7e", + "deepnote_cell_type": "text-cell-h2" + }, + "source": "## Heading 2", + "block_group": "371421bb44344a7d91a221f501ccc08c" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "757b5abe43d44ee9b42823483f7fa94e", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Heading 3", + "block_group": "8111c8912fbd4211a90ad965b6b79ec1" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "6b998af112b247d4823161d2524c3884", + "deepnote_cell_type": "text-cell-h3" + }, + "source": "### Heading 3", + "block_group": "259ddfd167f648e285a87d92577e2d41" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "4ee8f895f4ee4e7db92812375a7237fc", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Bulleted list", + "block_group": "9766707de7bc4685948657bff622b9f6" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "3ec20a06f52a4995851afa48ca9c8431", + "deepnote_cell_type": "text-cell-bullet" + }, + "source": "- Bullet one", + "block_group": "c9a02867dfa04173a4d2f51464fac194" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "762b4b013d304db682d2965cb7143332", + "deepnote_cell_type": "text-cell-bullet" + }, + "source": "- Bullet two", + "block_group": "8d21db08da194515a3932e066f77fb77" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "6f1dc7a2182b42d990fa00b643918dad", + "deepnote_cell_type": "text-cell-bullet" + }, + "source": "- Bullet three", + "block_group": "edc1ed0fb7614023bb7617fdc1c0abea" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "6306698eb9d44227b437011cd7284a55", + "deepnote_cell_type": "text-cell-p" + }, + "source": "To-do list", + "block_group": "f371ee9e94e1428ba8ec355e12dca38c" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "d375f293dbbf427881dd15d8b3ab581e", + "deepnote_cell_type": "text-cell-todo" + }, + "source": "- [ ] To-do item one", + "block_group": "b50b2211535a4f9782fce8051cacac66" + }, + { + "cell_type": "markdown", + "metadata": { + "checked": false, + "formattedRanges": [], + "cell_id": "8c6f19578edc41339e16f83bf6afd0e2", + "deepnote_cell_type": "text-cell-todo" + }, + "source": "- [ ] To-do item two", + "block_group": "0a4ff943c02e4fd4bfcf94a4ef386aa3" + }, + { + "cell_type": "markdown", + "metadata": { + "checked": false, + "formattedRanges": [], + "cell_id": "b4958debcbb54cd7968081c2f2895854", + "deepnote_cell_type": "text-cell-todo" + }, + "source": "- [ ] To-do item three", + "block_group": "888a33aafca844b6ac1597313858ef21" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "fdb6893d236c4188b4ae876e1c18f851", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Callout", + "block_group": "2d4e5049a24643c6a80a0a35559f8cc1" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "8e0bff4dbc24477891906d19a466c53d", + "deepnote_cell_type": "text-cell-callout" + }, + "source": "> A callout with some text", + "block_group": "e792897153f44d20ae6ffaefc0457262" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "d638f6b91dcc46c0961264fe7f6ea399", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Separator", + "block_group": "db67578e7dd348a9a3b1eae1f677373d" + }, + { + "cell_type": "markdown", + "metadata": { + "cell_id": "5e315049356f4cc1a198cb5d63d49f35", + "deepnote_cell_type": "separator" + }, + "source": "
", + "block_group": "7f45e1873f044edaabbf98eb954bb2f4" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "d39d8bc9ab9e4c6caf7306ceddeceae7", + "deepnote_cell_type": "text-cell-p" + }, + "source": "SQL", + "block_group": "c78377f47a68485d89d50951e8e28300" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "a3523be3", + "execution_start": 1758017229128, + "execution_millis": 371, + "sql_integration_id": "deepnote-dataframe-sql", + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "df", + "cell_id": "7c9da6307fea4f9f88bb4eedf53d9bdd", + "deepnote_cell_type": "sql", + "deepnote_sql_source": "SELECT * FROM df;" + }, + "source": "df = _dntk.execute_sql(\n 'SELECT * FROM df;',\n 'SQL_DEEPNOTE_DATAFRAME_SQL',\n audit_sql_comment='',\n sql_cache_mode='cache_disabled',\n return_variable_type='dataframe'\n)\ndf", + "block_group": "19c9f74d74b741f2b76c2bbb19b9e072", + "execution_count": 2, + "outputs": [ + { + "output_type": "execute_result", + "execution_count": 2, + "data": { + "application/vnd.deepnote.dataframe.v3+json": { + "column_count": 5, + "columns": [ + { + "name": "Name", + "dtype": "object", + "stats": { + "unique_count": 5, + "nan_count": 0, + "min": null, + "max": null, + "histogram": null, + "categories": [ + { + "name": "John", + "count": 1 + }, + { + "name": "Emma", + "count": 1 + }, + { + "name": "3 others", + "count": 3 + } + ] + } + }, + { + "name": "Age", + "dtype": "int64", + "stats": { + "unique_count": 5, + "nan_count": 0, + "min": "25", + "max": "42", + "histogram": [ + { + "bin_start": 25, + "bin_end": 26.7, + "count": 1 + }, + { + "bin_start": 26.7, + "bin_end": 28.4, + "count": 1 + }, + { + "bin_start": 28.4, + "bin_end": 30.1, + "count": 0 + }, + { + "bin_start": 30.1, + "bin_end": 31.8, + "count": 1 + }, + { + "bin_start": 31.8, + "bin_end": 33.5, + "count": 0 + }, + { + "bin_start": 33.5, + "bin_end": 35.2, + "count": 1 + }, + { + "bin_start": 35.2, + "bin_end": 36.9, + "count": 0 + }, + { + "bin_start": 36.9, + "bin_end": 38.6, + "count": 0 + }, + { + "bin_start": 38.6, + "bin_end": 40.3, + "count": 0 + }, + { + "bin_start": 40.3, + "bin_end": 42, + "count": 1 + } + ], + "categories": null + } + }, + { + "name": "Salary", + "dtype": "int64", + "stats": { + "unique_count": 5, + "nan_count": 0, + "min": "62000", + "max": "95000", + "histogram": [ + { + "bin_start": 62000, + "bin_end": 65300, + "count": 2 + }, + { + "bin_start": 65300, + "bin_end": 68600, + "count": 0 + }, + { + "bin_start": 68600, + "bin_end": 71900, + "count": 1 + }, + { + "bin_start": 71900, + "bin_end": 75200, + "count": 0 + }, + { + "bin_start": 75200, + "bin_end": 78500, + "count": 1 + }, + { + "bin_start": 78500, + "bin_end": 81800, + "count": 0 + }, + { + "bin_start": 81800, + "bin_end": 85100, + "count": 0 + }, + { + "bin_start": 85100, + "bin_end": 88400, + "count": 0 + }, + { + "bin_start": 88400, + "bin_end": 91700, + "count": 0 + }, + { + "bin_start": 91700, + "bin_end": 95000, + "count": 1 + } + ], + "categories": null + } + }, + { + "name": "Department", + "dtype": "object", + "stats": { + "unique_count": 4, + "nan_count": 0, + "min": null, + "max": null, + "histogram": null, + "categories": [ + { + "name": "IT", + "count": 2 + }, + { + "name": "HR", + "count": 1 + }, + { + "name": "2 others", + "count": 2 + } + ] + } + }, + { + "name": "Experience", + "dtype": "int64", + "stats": { + "unique_count": 5, + "nan_count": 0, + "min": "2", + "max": "12", + "histogram": [ + { + "bin_start": 2, + "bin_end": 3, + "count": 1 + }, + { + "bin_start": 3, + "bin_end": 4, + "count": 1 + }, + { + "bin_start": 4, + "bin_end": 5, + "count": 0 + }, + { + "bin_start": 5, + "bin_end": 6, + "count": 1 + }, + { + "bin_start": 6, + "bin_end": 7, + "count": 0 + }, + { + "bin_start": 7, + "bin_end": 8, + "count": 1 + }, + { + "bin_start": 8, + "bin_end": 9, + "count": 0 + }, + { + "bin_start": 9, + "bin_end": 10, + "count": 0 + }, + { + "bin_start": 10, + "bin_end": 11, + "count": 0 + }, + { + "bin_start": 11, + "bin_end": 12, + "count": 1 + } + ], + "categories": null + } + }, + { + "name": "_deepnote_index_column", + "dtype": "int64" + } + ], + "row_count": 5, + "preview_row_count": 5, + "rows": [ + { + "Name": "John", + "Age": 28, + "Salary": 65000, + "Department": "IT", + "Experience": 3, + "_deepnote_index_column": 0 + }, + { + "Name": "Emma", + "Age": 34, + "Salary": 78000, + "Department": "HR", + "Experience": 7, + "_deepnote_index_column": 1 + }, + { + "Name": "Michael", + "Age": 42, + "Salary": 95000, + "Department": "Finance", + "Experience": 12, + "_deepnote_index_column": 2 + }, + { + "Name": "Sarah", + "Age": 25, + "Salary": 62000, + "Department": "Marketing", + "Experience": 2, + "_deepnote_index_column": 3 + }, + { + "Name": "David", + "Age": 31, + "Salary": 70000, + "Department": "IT", + "Experience": 5, + "_deepnote_index_column": 4 + } + ], + "type": "dataframe" + }, + "text/plain": " Name Age Salary Department Experience\n0 John 28 65000 IT 3\n1 Emma 34 78000 HR 7\n2 Michael 42 95000 Finance 12\n3 Sarah 25 62000 Marketing 2\n4 David 31 70000 IT 5", + "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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
NameAgeSalaryDepartmentExperience
0John2865000IT3
1Emma3478000HR7
2Michael4295000Finance12
3Sarah2562000Marketing2
4David3170000IT5
\n
" + }, + "metadata": {} + } + ], + "outputs_reference": "s3:deepnote-cell-outputs-production/d418bf8c-946a-4cc6-afe8-fc2c7326f117", + "content_dependencies": { + "codeHash": "45c7afb1", + "usedVariables": [], + "importedModules": [], + "definedVariables": [] + } + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "623f0148d9e64e4a8ec1ffa43d5b58f9", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Chat", + "block_group": "90ed378eaa4d430d8f894680ca7a6b17" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "652dccd7", + "execution_start": 1758017230093, + "execution_millis": 125, + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "df", + "deepnote_visualization_spec": { + "layer": [ + { + "layer": [ + { + "layer": [ + { + "mark": { + "clip": true, + "type": "bar", + "color": "#2266D3", + "tooltip": true + }, + "encoding": { + "x": { + "axis": { + "title": "Employee name" + }, + "sort": null, + "type": "nominal", + "field": "Name", + "scale": { + "type": "linear" + } + }, + "y": { + "axis": { + "title": "Salary", + "format": { + "type": "number", + "decimals": null + }, + "formatType": "numberFormatFromNumberType" + }, + "type": "quantitative", + "field": "Salary", + "scale": { + "type": "linear" + }, + "format": { + "type": "default", + "decimals": null + }, + "aggregate": "sum", + "formatType": "numberFormatFromNumberType" + }, + "color": { + "type": "nominal", + "datum": "Salary", + "scale": { + "range": [ + "#2266D3" + ], + "domain": [ + "Salary" + ] + } + }, + "xOffset": { + "datum": "series_0" + } + }, + "transform": [] + } + ] + } + ], + "resolve": { + "scale": { + "color": "independent" + } + } + } + ], + "title": "Salary by employee", + "config": { + "legend": { + "disable": false + } + }, + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + "encoding": {}, + "usermeta": { + "seriesNames": [ + "Salary" + ], + "seriesOrder": [ + 0 + ], + "specSchemaVersion": 2, + "tooltipDefaultMode": true + } + }, + "cell_id": "d179318c9bea4fa7b280a6b503b713aa", + "deepnote_cell_type": "visualization" + }, + "source": "import inspect\n_dntk.DeepnoteChart(df, \"\"\"{\"layer\":[{\"layer\":[{\"layer\":[{\"mark\":{\"clip\":true,\"type\":\"bar\",\"color\":\"#2266D3\",\"tooltip\":true},\"encoding\":{\"x\":{\"axis\":{\"title\":\"Employee name\"},\"sort\":null,\"type\":\"nominal\",\"field\":\"Name\",\"scale\":{\"type\":\"linear\"}},\"y\":{\"axis\":{\"title\":\"Salary\",\"format\":{\"type\":\"number\",\"decimals\":null},\"formatType\":\"numberFormatFromNumberType\"},\"type\":\"quantitative\",\"field\":\"Salary\",\"scale\":{\"type\":\"linear\"},\"format\":{\"type\":\"default\",\"decimals\":null},\"aggregate\":\"sum\",\"formatType\":\"numberFormatFromNumberType\"},\"color\":{\"type\":\"nominal\",\"datum\":\"Salary\",\"scale\":{\"range\":[\"#2266D3\"],\"domain\":[\"Salary\"]}},\"xOffset\":{\"datum\":\"series_0\"}},\"transform\":[]}]}],\"resolve\":{\"scale\":{\"color\":\"independent\"}}}],\"title\":\"Salary by employee\",\"config\":{\"legend\":{\"disable\":false}},\"$schema\":\"https://vega.github.io/schema/vega-lite/v5.json\",\"encoding\":{},\"usermeta\":{\"seriesNames\":[\"Salary\"],\"seriesOrder\":[0],\"specSchemaVersion\":2,\"tooltipDefaultMode\":true}}\"\"\", **({'attach_selection': True} if 'attach_selection' in inspect.signature(_dntk.DeepnoteChart).parameters else {}), **({'filters': '[]'} if 'filters' in inspect.signature(_dntk.DeepnoteChart).parameters else {}))", + "block_group": "93602502de714543949d62c94101c476", + "execution_count": 3, + "outputs": [ + { + "output_type": "execute_result", + "execution_count": 3, + "data": { + "application/vnd.vega.v5+json": { + "$schema": "https://vega.github.io/schema/vega/v5.json", + "data": [ + { + "name": "legend_size_0_store" + }, + { + "name": "legend_color_0_store" + }, + { + "name": "interval_selection_store" + }, + { + "name": "source_0", + "values": [ + { + "Name": "John", + "sum_Salary": 65000 + }, + { + "Name": "Emma", + "sum_Salary": 78000 + }, + { + "Name": "Michael", + "sum_Salary": 95000 + }, + { + "Name": "Sarah", + "sum_Salary": 62000 + }, + { + "Name": "David", + "sum_Salary": 70000 + } + ] + }, + { + "name": "source_0_x_domain_Name", + "values": [ + { + "Name": "John" + }, + { + "Name": "Emma" + }, + { + "Name": "Michael" + }, + { + "Name": "Sarah" + }, + { + "Name": "David" + } + ] + }, + { + "name": "source_0_y_domain_sum_Salary", + "values": [ + { + "min": 62000, + "max": 95000 + } + ] + } + ], + "signals": [ + { + "name": "width", + "init": "isFinite(containerSize()[0]) ? containerSize()[0] : 200", + "on": [ + { + "events": "window:resize", + "update": "isFinite(containerSize()[0]) ? containerSize()[0] : 200" + } + ] + }, + { + "name": "height", + "init": "isFinite(containerSize()[1]) ? containerSize()[1] : 200", + "on": [ + { + "events": "window:resize", + "update": "isFinite(containerSize()[1]) ? containerSize()[1] : 200" + } + ] + }, + { + "name": "unit", + "value": {}, + "on": [ + { + "events": "pointermove", + "update": "isTuple(group()) ? group() : unit" + } + ] + }, + { + "name": "legend_size_0", + "update": "vlSelectionResolve(\"legend_size_0_store\", \"union\", true, true)" + }, + { + "name": "legend_color_0", + "update": "vlSelectionResolve(\"legend_color_0_store\", \"union\", true, true)" + }, + { + "name": "interval_selection", + "update": "vlSelectionResolve(\"interval_selection_store\", \"union\")" + }, + { + "name": "legend_size_0_tuple", + "on": [ + { + "events": [ + { + "source": "scope", + "type": "click" + } + ], + "update": "datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0 && indexof(item().mark.name, 'interval_selection_brush') < 0 ? {unit: \"layer_0_layer_0_layer_0\", fields: legend_size_0_tuple_fields, values: []} : null", + "force": true + }, + { + "events": [ + { + "source": "view", + "type": "dblclick" + } + ], + "update": "null" + } + ] + }, + { + "name": "legend_size_0_tuple_fields", + "value": [] + }, + { + "name": "legend_size_0_toggle", + "value": false, + "on": [ + { + "events": [ + { + "source": "scope", + "type": "click" + } + ], + "update": "true" + }, + { + "events": [ + { + "source": "view", + "type": "dblclick" + } + ], + "update": "false" + } + ] + }, + { + "name": "legend_size_0_modify", + "on": [ + { + "events": { + "signal": "legend_size_0_tuple" + }, + "update": "modify(\"legend_size_0_store\", legend_size_0_toggle ? null : legend_size_0_tuple, legend_size_0_toggle ? null : true, legend_size_0_toggle ? legend_size_0_tuple : null)" + } + ] + }, + { + "name": "legend_color_0_tuple", + "on": [ + { + "events": [ + { + "source": "scope", + "type": "click" + } + ], + "update": "datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0 && indexof(item().mark.name, 'interval_selection_brush') < 0 ? {unit: \"layer_0_layer_0_layer_0\", fields: legend_color_0_tuple_fields, values: []} : null", + "force": true + }, + { + "events": [ + { + "source": "view", + "type": "dblclick" + } + ], + "update": "null" + } + ] + }, + { + "name": "legend_color_0_tuple_fields", + "value": [] + }, + { + "name": "legend_color_0_toggle", + "value": false, + "on": [ + { + "events": [ + { + "source": "scope", + "type": "click" + } + ], + "update": "true" + }, + { + "events": [ + { + "source": "view", + "type": "dblclick" + } + ], + "update": "false" + } + ] + }, + { + "name": "legend_color_0_modify", + "on": [ + { + "events": { + "signal": "legend_color_0_tuple" + }, + "update": "modify(\"legend_color_0_store\", legend_color_0_toggle ? null : legend_color_0_tuple, legend_color_0_toggle ? null : true, legend_color_0_toggle ? legend_color_0_tuple : null)" + } + ] + }, + { + "name": "interval_selection_x", + "value": [], + "on": [ + { + "events": { + "source": "scope", + "filter": [ + "!event.item || event.item.mark.name !== \"interval_selection_brush\"" + ], + "type": "pointerdown" + }, + "update": "[x(unit), x(unit)]" + }, + { + "events": { + "source": "window", + "between": [ + { + "source": "scope", + "filter": [ + "!event.item || event.item.mark.name !== \"interval_selection_brush\"" + ], + "type": "pointerdown" + }, + { + "source": "window", + "type": "pointerup" + } + ], + "type": "pointermove", + "consume": true + }, + "update": "[interval_selection_x[0], clamp(x(unit), 0, width)]" + }, + { + "events": { + "signal": "interval_selection_scale_trigger" + }, + "update": "[0, 0]" + }, + { + "events": [ + { + "source": "view", + "type": "dblclick" + } + ], + "update": "[0, 0]" + }, + { + "events": { + "signal": "interval_selection_translate_delta" + }, + "update": "clampRange(panLinear(interval_selection_translate_anchor.extent_x, interval_selection_translate_delta.x / span(interval_selection_translate_anchor.extent_x)), 0, width)" + }, + { + "events": { + "signal": "interval_selection_zoom_delta" + }, + "update": "clampRange(zoomLinear(interval_selection_x, interval_selection_zoom_anchor.x, interval_selection_zoom_delta), 0, width)" + } + ] + }, + { + "name": "interval_selection_Name", + "on": [ + { + "events": { + "signal": "interval_selection_x" + }, + "update": "interval_selection_x[0] === interval_selection_x[1] ? null : invert(\"x\", interval_selection_x)" + } + ] + }, + { + "name": "interval_selection_scale_trigger", + "value": {}, + "on": [ + { + "events": [ + { + "scale": "x" + } + ], + "update": "(!isArray(interval_selection_Name) || (invert(\"x\", interval_selection_x)[0] === interval_selection_Name[0] && invert(\"x\", interval_selection_x)[1] === interval_selection_Name[1])) ? interval_selection_scale_trigger : {}" + } + ] + }, + { + "name": "interval_selection_tuple", + "on": [ + { + "events": [ + { + "signal": "interval_selection_Name" + } + ], + "update": "interval_selection_Name ? {unit: \"layer_0_layer_0_layer_0\", fields: interval_selection_tuple_fields, values: [interval_selection_Name]} : null" + } + ] + }, + { + "name": "interval_selection_tuple_fields", + "value": [ + { + "field": "Name", + "channel": "x", + "type": "E" + } + ] + }, + { + "name": "interval_selection_translate_anchor", + "value": {}, + "on": [ + { + "events": [ + { + "source": "scope", + "markname": "interval_selection_brush", + "type": "pointerdown" + } + ], + "update": "{x: x(unit), y: y(unit), extent_x: slice(interval_selection_x)}" + } + ] + }, + { + "name": "interval_selection_translate_delta", + "value": {}, + "on": [ + { + "events": [ + { + "source": "window", + "between": [ + { + "source": "scope", + "markname": "interval_selection_brush", + "type": "pointerdown" + }, + { + "source": "window", + "type": "pointerup" + } + ], + "consume": true, + "type": "pointermove" + } + ], + "update": "{x: interval_selection_translate_anchor.x - x(unit), y: interval_selection_translate_anchor.y - y(unit)}" + } + ] + }, + { + "name": "interval_selection_zoom_anchor", + "on": [ + { + "events": [ + { + "source": "scope", + "markname": "interval_selection_brush", + "type": "wheel", + "consume": true + } + ], + "update": "{x: x(unit), y: y(unit)}" + } + ] + }, + { + "name": "interval_selection_zoom_delta", + "on": [ + { + "events": [ + { + "source": "scope", + "markname": "interval_selection_brush", + "type": "wheel", + "consume": true + } + ], + "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))", + "force": true + } + ] + }, + { + "name": "interval_selection_modify", + "on": [ + { + "events": { + "signal": "interval_selection_tuple" + }, + "update": "modify(\"interval_selection_store\", interval_selection_tuple, true)" + } + ] + } + ], + "marks": [ + { + "type": "rect", + "name": "interval_selection_brush_bg", + "encode": { + "enter": { + "fillOpacity": { + "value": 0.125 + }, + "fill": { + "value": "#333" + } + }, + "update": { + "y": [ + { + "value": 0, + "test": "data(\"interval_selection_store\").length && data(\"interval_selection_store\")[0].unit === \"layer_0_layer_0_layer_0\"" + }, + { + "value": 0 + } + ], + "x": [ + { + "signal": "interval_selection_x[0]", + "test": "data(\"interval_selection_store\").length && data(\"interval_selection_store\")[0].unit === \"layer_0_layer_0_layer_0\"" + }, + { + "value": 0 + } + ], + "x2": [ + { + "signal": "interval_selection_x[1]", + "test": "data(\"interval_selection_store\").length && data(\"interval_selection_store\")[0].unit === \"layer_0_layer_0_layer_0\"" + }, + { + "value": 0 + } + ], + "y2": [ + { + "field": { + "signal": null, + "datum": null, + "group": "height", + "parent": null + }, + "test": "data(\"interval_selection_store\").length && data(\"interval_selection_store\")[0].unit === \"layer_0_layer_0_layer_0\"" + }, + { + "value": 0 + } + ] + } + }, + "clip": true + }, + { + "type": "rect", + "name": "layer_0_layer_0_layer_0_marks", + "from": { + "data": "source_0" + }, + "encode": { + "update": { + "fill": { + "value": "Salary", + "scale": "layer_0_layer_0_color" + }, + "opacity": [ + { + "value": 1, + "test": "(!length(data(\"legend_size_0_store\")) || vlSelectionTest(\"legend_size_0_store\", datum)) && (!length(data(\"legend_color_0_store\")) || vlSelectionTest(\"legend_color_0_store\", datum)) && (!length(data(\"interval_selection_store\")) || vlSelectionTest(\"interval_selection_store\", datum))" + }, + { + "value": 0.2 + } + ], + "width": { + "signal": "max(0.25, bandwidth('xOffset'))" + }, + "y": { + "field": "sum_Salary", + "scale": "y" + }, + "y2": { + "value": 0, + "scale": "y" + }, + "x": { + "field": "Name", + "scale": "x", + "offset": { + "value": "series_0", + "scale": "xOffset" + } + }, + "tooltip": { + "signal": "{\"Name\": isValid(datum[\"Name\"]) ? datum[\"Name\"] : \"\"+datum[\"Name\"], \"Sum of Salary\": numberFormatFromNumberType(datum[\"sum_Salary\"], {\"decimals\":null,\"type\":\"default\"})}" + } + } + }, + "style": [ + "bar" + ], + "interactive": true, + "clip": true + }, + { + "type": "rect", + "name": "interval_selection_brush", + "encode": { + "enter": { + "cursor": { + "value": "move" + }, + "fill": { + "value": "transparent" + } + }, + "update": { + "y2": [ + { + "field": { + "signal": null, + "datum": null, + "group": "height", + "parent": null + }, + "test": "data(\"interval_selection_store\").length && data(\"interval_selection_store\")[0].unit === \"layer_0_layer_0_layer_0\"" + }, + { + "value": 0 + } + ], + "y": [ + { + "value": 0, + "test": "data(\"interval_selection_store\").length && data(\"interval_selection_store\")[0].unit === \"layer_0_layer_0_layer_0\"" + }, + { + "value": 0 + } + ], + "x2": [ + { + "signal": "interval_selection_x[1]", + "test": "data(\"interval_selection_store\").length && data(\"interval_selection_store\")[0].unit === \"layer_0_layer_0_layer_0\"" + }, + { + "value": 0 + } + ], + "stroke": [ + { + "value": "white", + "test": "interval_selection_x[0] !== interval_selection_x[1]" + }, + {} + ], + "x": [ + { + "signal": "interval_selection_x[0]", + "test": "data(\"interval_selection_store\").length && data(\"interval_selection_store\")[0].unit === \"layer_0_layer_0_layer_0\"" + }, + { + "value": 0 + } + ] + } + }, + "clip": true + } + ], + "scales": [ + { + "name": "x", + "type": "band", + "domain": { + "data": "source_0_x_domain_Name", + "field": "Name" + }, + "range": [ + 0, + { + "signal": "width" + } + ], + "paddingOuter": 0.2, + "paddingInner": 0.2 + }, + { + "name": "y", + "type": "linear", + "domain": [ + { + "signal": "(data(\"source_0_y_domain_sum_Salary\")[0] || {}).min" + }, + { + "signal": "(data(\"source_0_y_domain_sum_Salary\")[0] || {}).max" + } + ], + "range": [ + { + "signal": "height" + }, + 0 + ], + "nice": true, + "zero": true + }, + { + "name": "xOffset", + "type": "band", + "domain": [ + "series_0" + ], + "range": [ + 0, + { + "signal": "bandwidth('x')" + } + ] + }, + { + "name": "layer_0_layer_0_color", + "type": "ordinal", + "domain": [ + "Salary" + ], + "range": [ + "#2266D3" + ] + } + ], + "axes": [ + { + "scale": "y", + "zindex": 0, + "ticks": false, + "gridScale": "x", + "labels": false, + "grid": true, + "tickCount": 5, + "domain": false, + "orient": "left", + "aria": false, + "maxExtent": 0, + "minExtent": 0 + }, + { + "scale": "x", + "labelAngle": 270, + "orient": "bottom", + "zindex": 0, + "title": "Employee name", + "grid": false, + "labelAlign": "right", + "labelBaseline": "middle" + }, + { + "scale": "y", + "labelOverlap": true, + "zindex": 0, + "encode": { + "labels": { + "update": { + "text": { + "signal": "numberFormatFromNumberType(datum.value, {\"decimals\":null,\"type\":\"number\"})" + } + } + } + }, + "orient": "left", + "tickCount": 5, + "grid": false, + "title": "Salary" + } + ], + "title": { + "text": "Salary by employee", + "frame": "group" + }, + "usermeta": { + "tooltipDefaultMode": true, + "seriesNames": [ + "Salary" + ], + "seriesOrder": [ + 0 + ], + "specSchemaVersion": 2, + "outputMetadata": { + "rowLimitExceeded": false, + "rowLimit": 5000, + "filteredDataframeSize": 5, + "columns": [ + { + "name": "Name", + "nativeType": "object", + "distinctValues": [ + "David", + "Emma", + "John", + "Michael", + "Sarah" + ] + }, + { + "name": "Age", + "nativeType": "int64", + "distinctValues": [ + 25, + 28, + 31, + 34, + 42 + ] + }, + { + "name": "Salary", + "nativeType": "int64", + "distinctValues": [ + 62000, + 65000, + 70000, + 78000, + 95000 + ] + }, + { + "name": "Department", + "nativeType": "object", + "distinctValues": [ + "Finance", + "HR", + "IT", + "Marketing" + ] + }, + { + "name": "Experience", + "nativeType": "int64", + "distinctValues": [ + 2, + 3, + 5, + 7, + 12 + ] + } + ] + } + }, + "background": "white", + "legends": [ + { + "fill": "layer_0_layer_0_color", + "symbolType": "square", + "encode": { + "symbols": { + "update": { + "opacity": { + "value": 1 + } + } + } + } + } + ], + "style": "cell", + "config": { + "customFormatTypes": true, + "legend": { + "disable": false + } + }, + "autosize": { + "type": "fit", + "contains": "padding" + }, + "padding": 5 + }, + "text/plain": "" + }, + "metadata": {} + } + ], + "outputs_reference": "s3:deepnote-cell-outputs-production/07e81c79-6b21-4a64-8f02-be5bb0c69030" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "d68fab5e9ee349a3a6a934ea10304bd2", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Big number", + "block_group": "d9c55e56e13745019ff43bad8b94ca6c" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "ea65eb57", + "execution_start": 1758017230260, + "execution_millis": 1, + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_big_number_title": "Max salary", + "deepnote_big_number_value": "salary_max", + "deepnote_big_number_format": "currency", + "deepnote_big_number_comparison_type": "", + "deepnote_big_number_comparison_title": "Difference with min", + "deepnote_big_number_comparison_value": "salary_min", + "deepnote_big_number_comparison_format": "", + "deepnote_big_number_comparison_enabled": true, + "cell_id": "0784d76e3a3b457e81ad97746f6a43db", + "deepnote_cell_type": "big-number" + }, + "source": "\ndef __deepnote_big_number__():\n import json\n import jinja2\n from jinja2 import meta\n\n def render_template(template):\n parsed_content = jinja2.Environment().parse(template)\n\n required_variables = meta.find_undeclared_variables(parsed_content)\n\n context = {\n variable_name: globals().get(variable_name)\n for variable_name in required_variables\n }\n\n result = jinja2.Environment().from_string(template).render(context)\n\n return result\n\n rendered_title = render_template(\"Max salary\")\n rendered_comparison_title = render_template(\"Difference with min\")\n\n return json.dumps({\n \"comparisonTitle\": rendered_comparison_title,\n \"comparisonValue\": f\"{salary_min}\",\n \"title\": rendered_title,\n \"value\": f\"{salary_max}\"\n })\n\n__deepnote_big_number__()\n", + "block_group": "69a7615d8fec4e018ad29df4f7c9c8a6", + "execution_count": 4, + "outputs": [ + { + "output_type": "execute_result", + "execution_count": 4, + "data": { + "text/plain": "'{\"comparisonTitle\": \"Difference with min\", \"comparisonValue\": \"62000\", \"title\": \"Max salary\", \"value\": \"95000\"}'" + }, + "metadata": {} + } + ], + "outputs_reference": "dbtable:cell_outputs/19abed1c-9e66-4083-8c4a-85c57b405437" + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "32ed71df884b4981bc29318d181a262f", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Text input", + "block_group": "9300674080aa47178c3e80f9603bf522" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "73002490", + "execution_start": 1758017230310, + "execution_millis": 0, + "deepnote_input_label": "Text input display name", + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "text_input", + "deepnote_variable_value": "", + "deepnote_variable_default_value": "Some text input value", + "cell_id": "dd80181c925945d4ac05a0e73735bfd7", + "deepnote_cell_type": "input-text" + }, + "source": "text_input = ''", + "block_group": "cde392347c26426286cecd44eb7cc80e", + "execution_count": 5, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "cb9eb2562ab54e9fb23cb063850ab96f", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Text area input", + "block_group": "843434fa29fb4926ac8e7d2c8708b683" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "dc8f2258", + "execution_start": 1758017230360, + "execution_millis": 0, + "deepnote_input_label": "Text area input", + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "text_area_input", + "deepnote_variable_value": "", + "deepnote_variable_default_value": "Some text area value", + "cell_id": "76928dac6eb6448b956cad7c988b986b", + "deepnote_cell_type": "input-textarea" + }, + "source": "text_area_input = ''", + "block_group": "0fbadd030dc44a55abdaba6c519a192c", + "execution_count": 6, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "ceb2e127c366476aaf2be1ccaebbd6c7", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Select input", + "block_group": "4d3f0ded61ae433f943e667f6aa0acac" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "f30613eb", + "execution_start": 1758017230410, + "execution_millis": 0, + "deepnote_input_label": "Select input display name", + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "select_input", + "deepnote_variable_value": "Option 1", + "deepnote_variable_options": [ + "Option 1", + "Option 2" + ], + "deepnote_variable_select_type": "from-options", + "deepnote_variable_default_value": "Option 1", + "deepnote_variable_custom_options": [ + "Option 1", + "Option 2" + ], + "deepnote_variable_selected_variable": "", + "cell_id": "2b166ddfac1440cca0286a43f3025f8f", + "deepnote_cell_type": "input-select" + }, + "source": "select_input = 'Option 1'", + "block_group": "8e1b14cb668a4a639812149ca1b076f0", + "execution_count": 7, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "55ff64d611854f01acb9c1ff53a818c4", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Slider input", + "block_group": "eeb937709b734d4ebfb10057b4f14427" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "903ebe60", + "execution_start": 1758017230460, + "execution_millis": 0, + "deepnote_input_label": "Slider input display name", + "deepnote_slider_step": 1, + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "slider_input", + "deepnote_variable_value": "5", + "deepnote_slider_max_value": 10, + "deepnote_slider_min_value": 0, + "deepnote_variable_default_value": "7", + "cell_id": "b449451a0b144edfb0318b7880d58766", + "deepnote_cell_type": "input-slider" + }, + "source": "slider_input = 5", + "block_group": "ce9d87717518498a8e258cd7ca4c530c", + "execution_count": 8, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "fa3d623fdd1a408f83a8d4e9c99addee", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Checkbox input", + "block_group": "0055729453894afa9c2a918ae9e4ad5d" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "43d96aab", + "execution_start": 1758017230510, + "execution_millis": 0, + "deepnote_input_label": "Checkbox input display name", + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "checkbox_input", + "deepnote_variable_value": false, + "deepnote_input_checkbox_label": "Checkbox label", + "deepnote_variable_default_value": true, + "cell_id": "fad66f544c9a4ea684dca1332b91efc7", + "deepnote_cell_type": "input-checkbox" + }, + "source": "checkbox_input = False", + "block_group": "b33c667b572f4a8a981b26f3153fd113", + "execution_count": 9, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "b2a2c3b06ade477fbdf64809480f3d38", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Date input", + "block_group": "997c3f11880641fcafd4e5d189f399c5" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "5506e6cf", + "execution_start": 1758017230560, + "execution_millis": 0, + "deepnote_input_label": "Date input display name", + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "date_input", + "deepnote_variable_value": "2025-09-16T00:00:00.000Z", + "deepnote_input_date_version": 2, + "deepnote_variable_default_value": "2025-08-27T00:00:00.000Z", + "cell_id": "0eb42d5848d04000a35d8a8d5aa9ae8a", + "deepnote_cell_type": "input-date" + }, + "source": "\nfrom dateutil.parser import parse as _deepnote_parse\ndate_input = _deepnote_parse('2025-09-16T00:00:00.000Z').date()\n", + "block_group": "76b2a29b9fbb43b88987d605df82c196", + "execution_count": 10, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "b01d032358784938961744976530f25d", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Date range input", + "block_group": "7bb4afb3b9e64ad9ac641040fae0f39f" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "df64ed1d", + "execution_start": 1758017230610, + "execution_millis": 0, + "deepnote_input_label": "Date range input display name", + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "date_range_input", + "deepnote_variable_value": "", + "deepnote_variable_default_value": [ + "2025-08-12", + "2025-08-14" + ], + "cell_id": "7ddc71b16587446c90aef2a70818b553", + "deepnote_cell_type": "input-date-range" + }, + "source": "date_range_input = [None, None]", + "block_group": "adb47271070b4ec5bd7ae36b6374ed8c", + "execution_count": 11, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "3a985da0d0214355aec385c9385a07da", + "deepnote_cell_type": "text-cell-p" + }, + "source": "File input", + "block_group": "f0729b0fd20546cfa27eb6cec10cd15a" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "2a21d71e", + "execution_start": 1758017230660, + "execution_millis": 0, + "deepnote_input_label": "File input display name", + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_variable_name": "file_input", + "deepnote_variable_value": "file_input_uploads/user_events_mini.csv", + "deepnote_allowed_file_extensions": ".csv", + "cell_id": "9dbdda490572489296ad648404f56231", + "deepnote_cell_type": "input-file" + }, + "source": "file_input = 'file_input_uploads/user_events_mini.csv'", + "block_group": "476d14d4916b408394563233abaf8b41", + "execution_count": 12, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "3e944bf94a6f4f4a92ce495715956720", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Button", + "block_group": "dca7628f959e4975abe29417fbb585e8" + }, + { + "cell_type": "markdown", + "metadata": { + "source_hash": "25dd0fc7", + "execution_start": 1758017230710, + "execution_millis": 0, + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_button_title": "Set variable", + "deepnote_variable_name": "button_input_set_variable", + "deepnote_button_behavior": "set_variable", + "deepnote_button_color_scheme": "blue", + "cell_id": "9d51fca1de7346aab1826bda7fe73e5b", + "deepnote_cell_type": "button" + }, + "source": "button_input_set_variable = False", + "block_group": "82e1707478464399abb956e9fdddda46", + "execution_count": 13, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "source_hash": "b623e53d", + "execution_start": 1758017230760, + "execution_millis": 0, + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "deepnote_button_title": "Run notebook", + "deepnote_variable_name": "button_1", + "deepnote_button_behavior": "run", + "deepnote_button_color_scheme": "blue", + "cell_id": "aad7b76caf2b4db5acd1b007ebb177aa", + "deepnote_cell_type": "button" + }, + "source": "", + "block_group": "2c8494b7dec74944bacc78a7b584bb79", + "execution_count": 13, + "outputs": [], + "outputs_reference": null + }, + { + "cell_type": "markdown", + "metadata": { + "formattedRanges": [], + "cell_id": "128f8bb9bb044011a8c658cca5ff9b76", + "deepnote_cell_type": "text-cell-p" + }, + "source": "Module", + "block_group": "44cdb835e3484a36b8e319e0a019b6da" + }, + { + "cell_type": "code", + "metadata": { + "source_hash": "5eb8ed6", + "execution_start": 1758017230810, + "execution_millis": 4331, + "execution_context_id": "43d850b5-85c3-4bc8-b2d5-b50f2529e42c", + "function_notebook_id": "704967b0680a4c15a30ba70ff8730844", + "function_notebook_inputs": { + "plan": { + "custom_value": null + } + }, + "last_function_run_started_at": 1758017230910, + "function_notebook_export_mappings": { + "wau": { + "enabled": true, + "variable_name": null + } + }, + "last_executed_function_notebook_id": "704967b0680a4c15a30ba70ff8730844", + "cell_id": "37c9905a3f8e4e4bbda4fc71fe942447", + "deepnote_cell_type": "notebook-function" + }, + "source": "def _deepnote_run_notebook_function(export_table_states_json):\n globals()['_deepnote_run_notebook_function'] = None\n\n return _dntk.run_notebook_function(\n scope=globals(),\n function_notebook_id='704967b0680a4c15a30ba70ff8730844',\n inputs={},\n export_mappings={'wau': {'enabled': True,'variable_name': 'wau'}},\n export_table_states_json=export_table_states_json,\n notebook_function_api_token='',\n parent_notebook_function_run_id=None,\n debug=False\n )", + "block_group": "15846815e8f743f582176f114aaf799f", + "execution_count": 14, + "outputs": [ + { + "output_type": "display_data", + "data": { + "application/vnd.deepnote.notebook-function-run-metadata+json": { + "notebook_function_run_id": "5a2e98eb-ba01-4e40-b097-bb212b196ce8", + "executed_notebook_id": "704967b0680a4c15a30ba70ff8730844", + "executed_notebook_name": "Modules: WAU", + "executed_notebook_inputs": {}, + "executed_notebook_imports": { + "wau": { + "enabled": true, + "variable_name": "wau" + } + }, + "executed_notebook_errors": [] + } + }, + "metadata": {} + }, + { + "output_type": "display_data", + "data": { + "application/vnd.deepnote.notebook-function-import-metadata+json": { + "export_name": "wau", + "export_data_type": null, + "export_table_state": null, + "variable_name": "wau" + } + }, + "metadata": {} + }, + { + "data": { + "application/vnd.deepnote.dataframe.v3+json": { + "column_count": 3, + "columns": [ + { + "name": "week_number", + "dtype": "int64", + "stats": { + "unique_count": 11, + "nan_count": 0, + "min": "1", + "max": "11", + "histogram": [ + { + "bin_start": 1, + "bin_end": 2, + "count": 1 + }, + { + "bin_start": 2, + "bin_end": 3, + "count": 1 + }, + { + "bin_start": 3, + "bin_end": 4, + "count": 1 + }, + { + "bin_start": 4, + "bin_end": 5, + "count": 1 + }, + { + "bin_start": 5, + "bin_end": 6, + "count": 1 + }, + { + "bin_start": 6, + "bin_end": 7, + "count": 1 + }, + { + "bin_start": 7, + "bin_end": 8, + "count": 1 + }, + { + "bin_start": 8, + "bin_end": 9, + "count": 1 + }, + { + "bin_start": 9, + "bin_end": 10, + "count": 1 + }, + { + "bin_start": 10, + "bin_end": 11, + "count": 2 + } + ], + "categories": null + } + }, + { + "name": "plan", + "dtype": "object", + "stats": { + "unique_count": 1, + "nan_count": 0, + "min": null, + "max": null, + "histogram": null, + "categories": [ + { + "name": "Team", + "count": 11 + } + ] + } + }, + { + "name": "weekly_active_users", + "dtype": "int64", + "stats": { + "unique_count": 4, + "nan_count": 0, + "min": "2", + "max": "5", + "histogram": [ + { + "bin_start": 2, + "bin_end": 2.3, + "count": 2 + }, + { + "bin_start": 2.3, + "bin_end": 2.6, + "count": 0 + }, + { + "bin_start": 2.6, + "bin_end": 2.9, + "count": 0 + }, + { + "bin_start": 2.9, + "bin_end": 3.2, + "count": 4 + }, + { + "bin_start": 3.2, + "bin_end": 3.5, + "count": 0 + }, + { + "bin_start": 3.5, + "bin_end": 3.8, + "count": 0 + }, + { + "bin_start": 3.8, + "bin_end": 4.1, + "count": 4 + }, + { + "bin_start": 4.1, + "bin_end": 4.4, + "count": 0 + }, + { + "bin_start": 4.4, + "bin_end": 4.699999999999999, + "count": 0 + }, + { + "bin_start": 4.699999999999999, + "bin_end": 5, + "count": 1 + } + ], + "categories": null + } + }, + { + "name": "_deepnote_index_column", + "dtype": "int64" + } + ], + "row_count": 11, + "preview_row_count": 11, + "rows": [ + { + "week_number": 1, + "plan": "Team", + "weekly_active_users": 4, + "_deepnote_index_column": 0 + }, + { + "week_number": 2, + "plan": "Team", + "weekly_active_users": 4, + "_deepnote_index_column": 1 + }, + { + "week_number": 3, + "plan": "Team", + "weekly_active_users": 4, + "_deepnote_index_column": 2 + }, + { + "week_number": 4, + "plan": "Team", + "weekly_active_users": 3, + "_deepnote_index_column": 3 + }, + { + "week_number": 5, + "plan": "Team", + "weekly_active_users": 3, + "_deepnote_index_column": 4 + }, + { + "week_number": 6, + "plan": "Team", + "weekly_active_users": 5, + "_deepnote_index_column": 5 + }, + { + "week_number": 7, + "plan": "Team", + "weekly_active_users": 2, + "_deepnote_index_column": 6 + }, + { + "week_number": 8, + "plan": "Team", + "weekly_active_users": 2, + "_deepnote_index_column": 7 + }, + { + "week_number": 9, + "plan": "Team", + "weekly_active_users": 3, + "_deepnote_index_column": 8 + }, + { + "week_number": 10, + "plan": "Team", + "weekly_active_users": 4, + "_deepnote_index_column": 9 + } + ], + "type": "dataframe" + }, + "text/plain": " week_number plan weekly_active_users\n0 1 Team 4\n1 2 Team 4\n2 3 Team 4\n3 4 Team 3\n4 5 Team 3\n5 6 Team 5\n6 7 Team 2\n7 8 Team 2\n8 9 Team 3\n9 10 Team 4\n10 11 Team 3", + "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 \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 \n \n \n \n \n
week_numberplanweekly_active_users
01Team4
12Team4
23Team4
34Team3
45Team3
56Team5
67Team2
78Team2
89Team3
910Team4
1011Team3
\n
" + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.deepnote.dataframe.v3+json": { + "column_count": 3, + "columns": [ + { + "name": "week_number", + "dtype": "int64", + "stats": { + "unique_count": 11, + "nan_count": 0, + "min": "1", + "max": "11", + "histogram": [ + { + "bin_start": 1, + "bin_end": 2, + "count": 1 + }, + { + "bin_start": 2, + "bin_end": 3, + "count": 1 + }, + { + "bin_start": 3, + "bin_end": 4, + "count": 1 + }, + { + "bin_start": 4, + "bin_end": 5, + "count": 1 + }, + { + "bin_start": 5, + "bin_end": 6, + "count": 1 + }, + { + "bin_start": 6, + "bin_end": 7, + "count": 1 + }, + { + "bin_start": 7, + "bin_end": 8, + "count": 1 + }, + { + "bin_start": 8, + "bin_end": 9, + "count": 1 + }, + { + "bin_start": 9, + "bin_end": 10, + "count": 1 + }, + { + "bin_start": 10, + "bin_end": 11, + "count": 2 + } + ], + "categories": null + } + }, + { + "name": "plan", + "dtype": "object", + "stats": { + "unique_count": 1, + "nan_count": 0, + "min": null, + "max": null, + "histogram": null, + "categories": [ + { + "name": "Team", + "count": 11 + } + ] + } + }, + { + "name": "weekly_active_users", + "dtype": "int64", + "stats": { + "unique_count": 4, + "nan_count": 0, + "min": "2", + "max": "5", + "histogram": [ + { + "bin_start": 2, + "bin_end": 2.3, + "count": 2 + }, + { + "bin_start": 2.3, + "bin_end": 2.6, + "count": 0 + }, + { + "bin_start": 2.6, + "bin_end": 2.9, + "count": 0 + }, + { + "bin_start": 2.9, + "bin_end": 3.2, + "count": 4 + }, + { + "bin_start": 3.2, + "bin_end": 3.5, + "count": 0 + }, + { + "bin_start": 3.5, + "bin_end": 3.8, + "count": 0 + }, + { + "bin_start": 3.8, + "bin_end": 4.1, + "count": 4 + }, + { + "bin_start": 4.1, + "bin_end": 4.4, + "count": 0 + }, + { + "bin_start": 4.4, + "bin_end": 4.699999999999999, + "count": 0 + }, + { + "bin_start": 4.699999999999999, + "bin_end": 5, + "count": 1 + } + ], + "categories": null + } + }, + { + "name": "_deepnote_index_column", + "dtype": "int64" + } + ], + "row_count": 11, + "preview_row_count": 11, + "rows": [ + { + "week_number": 1, + "plan": "Team", + "weekly_active_users": 4, + "_deepnote_index_column": 0 + }, + { + "week_number": 2, + "plan": "Team", + "weekly_active_users": 4, + "_deepnote_index_column": 1 + }, + { + "week_number": 3, + "plan": "Team", + "weekly_active_users": 4, + "_deepnote_index_column": 2 + }, + { + "week_number": 4, + "plan": "Team", + "weekly_active_users": 3, + "_deepnote_index_column": 3 + }, + { + "week_number": 5, + "plan": "Team", + "weekly_active_users": 3, + "_deepnote_index_column": 4 + }, + { + "week_number": 6, + "plan": "Team", + "weekly_active_users": 5, + "_deepnote_index_column": 5 + }, + { + "week_number": 7, + "plan": "Team", + "weekly_active_users": 2, + "_deepnote_index_column": 6 + }, + { + "week_number": 8, + "plan": "Team", + "weekly_active_users": 2, + "_deepnote_index_column": 7 + }, + { + "week_number": 9, + "plan": "Team", + "weekly_active_users": 3, + "_deepnote_index_column": 8 + }, + { + "week_number": 10, + "plan": "Team", + "weekly_active_users": 4, + "_deepnote_index_column": 9 + } + ], + "type": "dataframe" + }, + "text/plain": " week_number plan weekly_active_users\n0 1 Team 4\n1 2 Team 4\n2 3 Team 4\n3 4 Team 3\n4 5 Team 3\n5 6 Team 5\n6 7 Team 2\n7 8 Team 2\n8 9 Team 3\n9 10 Team 4\n10 11 Team 3", + "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 \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 \n \n \n \n \n
week_numberplanweekly_active_users
01Team4
12Team4
23Team4
34Team3
45Team3
56Team5
67Team2
78Team2
89Team3
910Team4
1011Team3
\n
" + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "output_type": "execute_result", + "execution_count": 14, + "data": { + "text/plain": "{'cursors': {'wau': week_number plan weekly_active_users\n 0 1 Team 4\n 1 2 Team 4\n 2 3 Team 4\n 3 4 Team 3\n 4 5 Team 3\n 5 6 Team 5\n 6 7 Team 2\n 7 8 Team 2\n 8 9 Team 3\n 9 10 Team 4\n 10 11 Team 3}}" + }, + "metadata": {} + } + ], + "outputs_reference": "s3:deepnote-cell-outputs-production/3aa96f8d-93d5-422f-918b-a2337ef997bf" + }, + { + "cell_type": "markdown", + "source": "\nCreated in deepnote.com \nCreated in Deepnote", + "metadata": { + "created_in_deepnote_cell": true, + "deepnote_cell_type": "markdown" + } + } + ], + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "deepnote_persisted_session": { + "createdAt": "2025-08-28T10:32:55.310Z" + }, + "deepnote_notebook_id": "7d33aeac2a3f4b69beb3cf17f1c3733d" + } +} diff --git a/jupyterlab_deepnote/contents.py b/jupyterlab_deepnote/contents.py index 679d01f..d02c571 100644 --- a/jupyterlab_deepnote/contents.py +++ b/jupyterlab_deepnote/contents.py @@ -3,7 +3,8 @@ from typing import cast import yaml -from nbformat.v4 import new_notebook, new_code_cell, new_markdown_cell +from nbformat.v4 import new_notebook +from .convert_format import convert_blocks_to_cells def yaml_to_ipynb(yaml_text: str): @@ -27,14 +28,7 @@ def yaml_to_ipynb(yaml_text: str): all_notebooks = {} for nb in notebooks: nb_blocks = nb.get("blocks", []) - nb_cells = [] - for block in sorted(nb_blocks, key=lambda b: b.get("sortingKey", "")): - btype = block.get("type", "code") - content = block.get("content", "") - if btype == "code": - nb_cells.append(new_code_cell(content)) - else: - nb_cells.append(new_markdown_cell(content)) + nb_cells = convert_blocks_to_cells(nb_blocks) # Use the notebook name as key nb_name = nb.get("name", "") all_notebooks[nb_name] = new_notebook(cells=nb_cells) @@ -42,14 +36,7 @@ def yaml_to_ipynb(yaml_text: str): # Use first notebook's cells to render initially nb0 = notebooks[0] blocks = nb0.get("blocks", []) - cells = [] - for block in sorted(blocks, key=lambda b: b.get("sortingKey", "")): - btype = block.get("type", "code") - content = block.get("content", "") - if btype == "code": - cells.append(new_code_cell(content)) - else: - cells.append(new_markdown_cell(content)) + cells = convert_blocks_to_cells(blocks) metadata = { "deepnote": {"notebook_names": notebook_names, "notebooks": all_notebooks} diff --git a/jupyterlab_deepnote/convert_format.py b/jupyterlab_deepnote/convert_format.py new file mode 100644 index 0000000..4d81cc5 --- /dev/null +++ b/jupyterlab_deepnote/convert_format.py @@ -0,0 +1,404 @@ +from nbformat.v4 import new_code_cell, new_markdown_cell +import re + + +# Helper: Map Deepnote block type to Jupyter cell type +def map_block_type_to_jupyter(btype: str) -> str: + # Mirror convertCellTypeToJupyter from utils.ts + code_types = { + "big-number", + "code", + "sql", + # "notebook-function", # notebook-function is no longer a code type + "input-text", + "input-checkbox", + "input-textarea", + "input-file", + "input-select", + "input-date-range", + "input-date", + "input-slider", + "visualization", + } + markdown_types = { + "markdown", + "text-cell-h1", + "text-cell-h2", + "text-cell-h3", + "text-cell-p", + "text-cell-bullet", + "text-cell-todo", + "text-cell-callout", + "image", + "button", + "separator", + "notebook-function", # treat notebook-function as markdown + } + if btype in code_types: + return "code" + elif btype in markdown_types: + return "markdown" + else: + return "markdown" + + +# Helper: Sanitize a string to a valid Python variable name (mirrors TS sanitizePythonVariableName) +def sanitize_python_variable_name( + name: str, disable_empty_fallback: bool = False +) -> str: + # Replace whitespace with underscores + sanitized = re.sub(r"\s+", "_", name) + # Remove invalid characters + sanitized = re.sub(r"[^0-9a-zA-Z_]", "", sanitized) + # Remove invalid leading characters + sanitized = re.sub(r"^[^a-zA-Z_]+", "", sanitized) + if sanitized == "" and not disable_empty_fallback: + sanitized = "input_1" + return sanitized + + +# Helper: Escape a string for safe use as a Python string literal (mirrors TS escapePythonString) +def escape_python_string(value) -> str: + # Ensure value is always a string + if not isinstance(value, str): + value = str(value) + # Escape backslashes, single quotes, and newlines, then wrap in single quotes + escaped = value.replace("\\", "\\\\").replace("'", "\\'").replace("\n", "\\n") + return f"'{escaped}'" + + +# Helper: Helper for big-number cell +def execute_big_number( + title_template: str, + value_variable_name: str, + comparison_title_template: str = "", + comparison_variable_name: str = "", +) -> str: + value_part = f'f"{{{value_variable_name}}}"' if value_variable_name else '""' + comparison_value_part = ( + f'f"{{{comparison_variable_name}}}"' if comparison_variable_name else '""' + ) + # Use triple-quoted string for multiline Python code + return f""" +def __deepnote_big_number__(): + import json + import jinja2 + from jinja2 import meta + + def render_template(template): + parsed_content = jinja2.Environment().parse(template) + + required_variables = meta.find_undeclared_variables(parsed_content) + + context = {{ + variable_name: globals().get(variable_name) + for variable_name in required_variables + }} + + result = jinja2.Environment().from_string(template).render(context) + + return result + + rendered_title = render_template("{title_template}") + rendered_comparison_title = render_template("{comparison_title_template}") + + return json.dumps({{ + "comparisonTitle": rendered_comparison_title, + "comparisonValue": {comparison_value_part}, + "title": rendered_title, + "value": {value_part} + }}) + +__deepnote_big_number__() +""".lstrip() + + +# Helper: Execute SQL query (Python code generator, mirrors TS executeSqlQuery) +def execute_sql_query( + query: str, + connection_env_var: str, + python_variable_name: str | None, + sql_cache_mode: str, + return_variable_type: str, +) -> str: + # Escape query and audit comment for Python string literal + def escape_python_string(value: str) -> str: + # Escape backslashes, single quotes, and newlines, then wrap in single quotes + escaped = value.replace("\\", "\\\\").replace("'", "\\'").replace("\n", "\\n") + return f"'{escaped}'" + + escaped_query = escape_python_string(query) + escaped_audit_comment = "''" # No audit comment in this context + connection_env_var_str = connection_env_var or "" + # Build the function call + execute_sql_code = ( + f"_dntk.execute_sql(\n" + f" {escaped_query},\n" + f" '{connection_env_var_str}',\n" + f" audit_sql_comment={escaped_audit_comment},\n" + f" sql_cache_mode='{sql_cache_mode}',\n" + f" return_variable_type='{return_variable_type}'\n" + f")" + ) + if python_variable_name: + return f"{python_variable_name} = {execute_sql_code}\n{python_variable_name}" + else: + return execute_sql_code + + +# --- Date range input helpers --- + + +def is_valid_absolute_date_range(value): + # Accepts [start, end] where both are strings or empty string + if not isinstance(value, (list, tuple)): + return False + if len(value) != 2: + return False + s, e = value + + # Accepts empty string or ISO date string + def is_date_or_empty(x): + return x == "" or (isinstance(x, str) and re.match(r"^\d{4}-\d{2}-\d{2}", x)) + + return is_date_or_empty(s) and is_date_or_empty(e) + + +def is_custom_date_range(value): + # Accepts string like "customDays14" + if not isinstance(value, str): + return False + return value.startswith("customDays") and value[10:].isdigit() + + +def is_valid_relative_date_interval(value): + # Accepts one of the known keys + if not isinstance(value, str): + return value in [] + return value in DATE_RANGE_INPUT_RELATIVE_RANGES + + +def date_range_absolute(name, start_date, end_date): + # Both start_date and end_date are strings, may be empty + code = [] + code.append("from dateutil.parser import parse as _deepnote_parse") + sd = f"_deepnote_parse('{start_date}').date()" if start_date else "None" + ed = f"_deepnote_parse('{end_date}').date()" if end_date else "None" + code.append(f"{name} = [{sd}, {ed}]") + return "\n".join(code) + + +def date_range_custom_days(name, days): + return ( + "from datetime import datetime, timedelta\n" + f"{name} = [datetime.now().date() - timedelta(days={days}), datetime.now().date()]" + ) + + +def date_range_past7days(name): + return ( + "from datetime import datetime as _deepnote_datetime, timedelta as _deepnote_timedelta\n" + f"{name} = [_deepnote_datetime.now().date() - _deepnote_timedelta(days=7), _deepnote_datetime.now().date()]" + ) + + +def date_range_past14days(name): + return ( + "from datetime import datetime as _deepnote_datetime, timedelta as _deepnote_timedelta\n" + f"{name} = [_deepnote_datetime.now().date() - _deepnote_timedelta(days=14), _deepnote_datetime.now().date()]" + ) + + +def date_range_pastMonth(name): + return ( + "from datetime import datetime as _deepnote_datetime\n" + "from dateutil.relativedelta import relativedelta\n" + f"{name} = [_deepnote_datetime.now().date() - relativedelta(months=1), _deepnote_datetime.now().date()]" + ) + + +def date_range_past3months(name): + return ( + "from datetime import datetime as _deepnote_datetime\n" + "from dateutil.relativedelta import relativedelta\n" + f"{name} = [_deepnote_datetime.now().date() - relativedelta(months=3), _deepnote_datetime.now().date()]" + ) + + +def date_range_past6months(name): + return ( + "from datetime import datetime as _deepnote_datetime\n" + "from dateutil.relativedelta import relativedelta\n" + f"{name} = [_deepnote_datetime.now().date() - relativedelta(months=6), _deepnote_datetime.now().date()]" + ) + + +def date_range_pastYear(name): + return ( + "from datetime import datetime as _deepnote_datetime\n" + "from dateutil.relativedelta import relativedelta\n" + f"{name} = [_deepnote_datetime.now().date() - relativedelta(years=1), _deepnote_datetime.now().date()]" + ) + + +DATE_RANGE_INPUT_RELATIVE_RANGES = { + "past7days": date_range_past7days, + "past14days": date_range_past14days, + "pastMonth": date_range_pastMonth, + "past3months": date_range_past3months, + "past6months": date_range_past6months, + "pastYear": date_range_pastYear, +} + + +# Helper: Map Deepnote block source (content) for Jupyter +def map_block_source(btype: str, content: str, metadata: dict) -> str: + # Handle all text-cell-* types and separator, else return content unchanged + if btype == "text-cell-h1": + return "# " + content + elif btype == "text-cell-h2": + return "## " + content + elif btype == "text-cell-h3": + return "### " + content + elif btype == "text-cell-bullet": + return "- " + content + elif btype == "text-cell-todo": + checked = metadata.get("checked", False) + return "- [x] " + content if checked else "- [ ] " + content + elif btype == "text-cell-callout": + return "> " + content + elif btype == "separator": + return "
" + elif btype == "input-text" or btype == "input-textarea" or btype == "input-slider": + # Generate Python assignment: {sanitized_variable_name} = {escaped_value} + var_name = sanitize_python_variable_name( + metadata.get("deepnote_variable_name", "") + ) + value = escape_python_string(metadata.get("deepnote_variable_value", "")) + return f"{var_name} = {value}" + elif btype == "input-checkbox": + # Sanitize variable name and assign True/False based on value + var_name = sanitize_python_variable_name( + metadata.get("deepnote_variable_name", "") + ) + value = metadata.get("deepnote_variable_value") + return f"{var_name} = {'True' if value else 'False'}" + elif btype == "input-select": + var_name = sanitize_python_variable_name( + metadata.get("deepnote_variable_name", "") + ) + allow_multiple = metadata.get("deepnote_allow_multiple_values") + values = metadata.get("deepnote_variable_value", None) + # If allow_multiple is truthy or values is a list, treat as list assignment + if allow_multiple or isinstance(values, list): + # Ensure values is a list + if not isinstance(values, list): + values = [values] if values is not None else [] + return ( + f"{var_name} = [{', '.join(escape_python_string(v) for v in values)}]" + ) + # If not allow_multiple and value is falsy (None or empty string), assign None + elif not allow_multiple and (values is None or values == ""): + return f"{var_name} = None" + else: + # Explicitly convert to string for type safety + return f"{var_name} = {escape_python_string(str(values or ''))}" + elif btype == "input-date": + var_name = sanitize_python_variable_name( + metadata.get("deepnote_variable_name", "") + ) + escaped_value = escape_python_string( + metadata.get("deepnote_variable_value", "") + ) + if not metadata.get("deepnote_variable_value"): + return f"{var_name} = None" + elif metadata.get("deepnote_input_date_version") == 2: + return ( + f"from dateutil.parser import parse as _deepnote_parse\n" + f"{var_name} = _deepnote_parse({escaped_value}).date()" + ) + else: + return ( + f"from datetime import datetime as _deepnote_datetime\n" + f'{var_name} = _deepnote_datetime.strptime({escaped_value}, "%Y-%m-%dT%H:%M:%S.%fZ")' + ) + elif btype == "input-date-range": + var_name = sanitize_python_variable_name( + metadata.get("deepnote_variable_name", "") + ) + value = metadata.get("deepnote_variable_value", None) + # Absolute date range: [start, end] + if isinstance(value, (list, tuple)) and is_valid_absolute_date_range(value): + start, end = value + return date_range_absolute(var_name, start, end) + # Custom days: "customDaysN" + elif isinstance(value, str) and is_custom_date_range(value): + try: + days = int(str(value)[10:]) + except Exception: + return f"{var_name} = None" + return date_range_custom_days(var_name, days) + # Relative interval: "past7days", etc. + elif isinstance(value, str) and is_valid_relative_date_interval(value): + fn = ( + DATE_RANGE_INPUT_RELATIVE_RANGES.get(value) + if isinstance(value, str) + else None + ) + if fn: + return fn(var_name) + else: + return f"{var_name} = [None, None]" + else: + return f"{var_name} = [None, None]" + elif btype == "big-number": + # Extract big-number fields from metadata and call helper + title = metadata.get("deepnote_big_number_title", "") + value_var = metadata.get("deepnote_big_number_value", "") + comparison_title = metadata.get("deepnote_big_number_comparison_title", "") + comparison_var = metadata.get("deepnote_big_number_comparison_value", "") + return execute_big_number(title, value_var, comparison_title, comparison_var) + elif btype == "sql": + integration_id = metadata.get("sql_integration_id") + if integration_id: + connection_env_var = f"SQL_{integration_id}" + else: + connection_env_var = "SQL_ALCHEMY_JSON_ENV_VAR" + var_name = metadata.get("deepnote_variable_name") + var_name = sanitize_python_variable_name(var_name) if var_name else None + return_variable_type = metadata.get( + "deepnote_return_variable_type", "dataframe" + ) + return execute_sql_query( + content, + connection_env_var, + var_name or None, + "cache_disabled", + return_variable_type, + ) + elif btype == "notebook-function": + return "Module blocks are a [Deepnote.com only feature](https://deepnote.com). Please import this .deepnote file into your workspace on [Deepnote.com](https://deepnote.com) to use this module block." + else: + return content + + +# Helper: Convert a Deepnote block dict to a Jupyter cell +def convert_deepnote_block_to_jupyter_cell(block: dict): + btype = block.get("type", "markdown") + content = block.get("content", "") + source = map_block_source(btype, content, block.get("metadata", {})) + + jupyter_type = map_block_type_to_jupyter(btype) + + if jupyter_type == "code": + return new_code_cell(source) + else: + return new_markdown_cell(source) + + +# Helper: Convert a list of Deepnote blocks to sorted list of Jupyter cells +def convert_blocks_to_cells(blocks: list[dict]): + return [ + convert_deepnote_block_to_jupyter_cell(block) + for block in sorted(blocks, key=lambda b: b.get("sortingKey", "")) + ]