Skip to content

Commit c61ca30

Browse files
committed
fix example
1 parent deda04c commit c61ca30

File tree

1 file changed

+17
-137
lines changed

1 file changed

+17
-137
lines changed

examples/ConditionalFormatting.ipynb

Lines changed: 17 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,9 @@
1616
},
1717
{
1818
"cell_type": "code",
19-
"execution_count": 26,
19+
"execution_count": null,
2020
"metadata": {},
21-
"outputs": [
22-
{
23-
"data": {
24-
"application/vnd.jupyter.widget-view+json": {
25-
"model_id": "84885f1b70774e11a322cfd4bbc9b13f",
26-
"version_major": 2,
27-
"version_minor": 0
28-
},
29-
"text/plain": [
30-
"DataGrid(base_column_size=150, default_renderer=TextRenderer(background_color=VegaExpr(value=\"cell.value[1] ==…"
31-
]
32-
},
33-
"metadata": {},
34-
"output_type": "display_data"
35-
}
36-
],
21+
"outputs": [],
3722
"source": [
3823
"import pandas as pd\n",
3924
"from ipydatagrid import DataGrid, TextRenderer, VegaExpr\n",
@@ -49,24 +34,9 @@
4934
},
5035
{
5136
"cell_type": "code",
52-
"execution_count": 27,
37+
"execution_count": null,
5338
"metadata": {},
54-
"outputs": [
55-
{
56-
"data": {
57-
"application/vnd.jupyter.widget-view+json": {
58-
"model_id": "fdccc87c437542ff9e37af623ea79794",
59-
"version_major": 2,
60-
"version_minor": 0
61-
},
62-
"text/plain": [
63-
"DataGrid(base_column_size=150, default_renderer=TextRenderer(background_color=VegaExpr(value=\"cell.value[1] ==…"
64-
]
65-
},
66-
"metadata": {},
67-
"output_type": "display_data"
68-
}
69-
],
39+
"outputs": [],
7040
"source": [
7141
"import pandas as pd\n",
7242
"from ipydatagrid import DataGrid, TextRenderer, VegaExpr\n",
@@ -83,24 +53,9 @@
8353
},
8454
{
8555
"cell_type": "code",
86-
"execution_count": 28,
56+
"execution_count": null,
8757
"metadata": {},
88-
"outputs": [
89-
{
90-
"data": {
91-
"application/vnd.jupyter.widget-view+json": {
92-
"model_id": "",
93-
"version_major": 2,
94-
"version_minor": 0
95-
},
96-
"text/plain": [
97-
"DataGrid(base_column_size=150, default_renderer=TextRenderer(background_color=VegaExpr(value=\"cell.value[1] ==…"
98-
]
99-
},
100-
"metadata": {},
101-
"output_type": "display_data"
102-
}
103-
],
58+
"outputs": [],
10459
"source": [
10560
"import pandas as pd\n",
10661
"from ipydatagrid import DataGrid, TextRenderer, VegaExpr\n",
@@ -117,24 +72,9 @@
11772
},
11873
{
11974
"cell_type": "code",
120-
"execution_count": 37,
75+
"execution_count": null,
12176
"metadata": {},
122-
"outputs": [
123-
{
124-
"data": {
125-
"application/vnd.jupyter.widget-view+json": {
126-
"model_id": "89275c595316461eadbbb89797fa2cce",
127-
"version_major": 2,
128-
"version_minor": 0
129-
},
130-
"text/plain": [
131-
"DataGrid(base_column_size=150, default_renderer=TextRenderer(background_color=VegaExpr(value=\"cell.value[1] ==…"
132-
]
133-
},
134-
"metadata": {},
135-
"output_type": "display_data"
136-
}
137-
],
77+
"outputs": [],
13878
"source": [
13979
"import pandas as pd\n",
14080
"from ipydatagrid import DataGrid, TextRenderer, VegaExpr\n",
@@ -157,26 +97,11 @@
15797
},
15898
{
15999
"cell_type": "code",
160-
"execution_count": 29,
100+
"execution_count": null,
161101
"metadata": {
162102
"scrolled": false
163103
},
164-
"outputs": [
165-
{
166-
"data": {
167-
"application/vnd.jupyter.widget-view+json": {
168-
"model_id": "93307ccc70b0495cb6311f9c588a52b3",
169-
"version_major": 2,
170-
"version_minor": 0
171-
},
172-
"text/plain": [
173-
"DataGrid(base_column_size=300, base_row_size=30, default_renderer=TextRenderer(), header_renderer=None, layout…"
174-
]
175-
},
176-
"metadata": {},
177-
"output_type": "display_data"
178-
}
179-
],
104+
"outputs": [],
180105
"source": [
181106
"# Imports\n",
182107
"import json\n",
@@ -198,7 +123,7 @@
198123
"\n",
199124
"# Formatting the values in column 1 based on the value of the silbing row in column 2\n",
200125
"def format_based_on_other_column(cell):\n",
201-
" return 'green' if cell.metadata.data['Column 1'] > 0.0 else 'yellow'\n",
126+
" return 'green' if cell.metadata.data['Column 2'] > 0.0 else 'yellow'\n",
202127
"\n",
203128
"column1_formatting = TextRenderer(\n",
204129
" text_color='black',\n",
@@ -223,24 +148,9 @@
223148
},
224149
{
225150
"cell_type": "code",
226-
"execution_count": 30,
151+
"execution_count": null,
227152
"metadata": {},
228-
"outputs": [
229-
{
230-
"data": {
231-
"application/vnd.jupyter.widget-view+json": {
232-
"model_id": "6665f2c0fe7d40b4a2a7d136b5b858e1",
233-
"version_major": 2,
234-
"version_minor": 0
235-
},
236-
"text/plain": [
237-
"DataGrid(base_column_size=90, default_renderer=TextRenderer(background_color=Expr(value='(((cell.value > -0) &…"
238-
]
239-
},
240-
"metadata": {},
241-
"output_type": "display_data"
242-
}
243-
],
153+
"outputs": [],
244154
"source": [
245155
"import ipydatagrid as ipg\n",
246156
"import pandas as pd\n",
@@ -269,24 +179,9 @@
269179
},
270180
{
271181
"cell_type": "code",
272-
"execution_count": 31,
182+
"execution_count": null,
273183
"metadata": {},
274-
"outputs": [
275-
{
276-
"data": {
277-
"application/vnd.jupyter.widget-view+json": {
278-
"model_id": "a8d18e6910a74f3ea9cfa3dfb7ec21d5",
279-
"version_major": 2,
280-
"version_minor": 0
281-
},
282-
"text/plain": [
283-
"DataGrid(base_column_size=300, base_row_size=30, default_renderer=TextRenderer(), header_renderer=None, layout…"
284-
]
285-
},
286-
"metadata": {},
287-
"output_type": "display_data"
288-
}
289-
],
184+
"outputs": [],
290185
"source": [
291186
"def format_based_on_other_column(cell):\n",
292187
" return 'green' if cell.column == 0 and cell.metadata.data['Signal'] == \"Buy\" else 'red'\n",
@@ -315,24 +210,9 @@
315210
},
316211
{
317212
"cell_type": "code",
318-
"execution_count": 32,
213+
"execution_count": null,
319214
"metadata": {},
320-
"outputs": [
321-
{
322-
"data": {
323-
"application/vnd.jupyter.widget-view+json": {
324-
"model_id": "6b70839957b74d79a79818c94ca8654c",
325-
"version_major": 2,
326-
"version_minor": 0
327-
},
328-
"text/plain": [
329-
"DataGrid(base_column_size=300, base_row_size=30, default_renderer=TextRenderer(), header_renderer=None, layout…"
330-
]
331-
},
332-
"metadata": {},
333-
"output_type": "display_data"
334-
}
335-
],
215+
"outputs": [],
336216
"source": [
337217
"import json\n",
338218
"\n",

0 commit comments

Comments
 (0)