|
2 | 2 | "cells": [
|
3 | 3 | {
|
4 | 4 | "cell_type": "markdown",
|
5 |
| - "id": "3b1e5b84", |
| 5 | + "id": "c5f44e87", |
6 | 6 | "metadata": {},
|
7 | 7 | "source": [
|
8 | 8 | "# pandas-render\n",
|
9 | 9 | "\n",
|
10 |
| - "[pandas-render](https://github.com/nok/pandas-render) is a [pandas](https://github.com/pandas-dev/pandas) extension for rendering DataFrames and Series as HTML tables, with support for custom styling and formatting.\n", |
11 |
| - "\n", |
12 |
| - "Installation:\n", |
13 |
| - "\n", |
14 |
| - "```bash\n", |
15 |
| - "pip install pandas-render\n", |
16 |
| - "```\n", |
17 |
| - "\n", |
18 | 10 | "## Getting Started\n",
|
19 | 11 | "\n",
|
20 | 12 | "This example shows how to use pandas-render to create a simple HTML table from a pandas DataFrame. It demonstrates how to use Jinja2 templates to format the content of each cell, and how to create links and images in the table.\n",
|
|
26 | 18 | {
|
27 | 19 | "cell_type": "code",
|
28 | 20 | "execution_count": 1,
|
29 |
| - "id": "80111e60", |
| 21 | + "id": "16298615", |
30 | 22 | "metadata": {
|
31 | 23 | "execution": {
|
32 |
| - "iopub.execute_input": "2025-04-09T23:15:05.636164Z", |
33 |
| - "iopub.status.busy": "2025-04-09T23:15:05.635773Z", |
34 |
| - "iopub.status.idle": "2025-04-09T23:15:05.887448Z", |
35 |
| - "shell.execute_reply": "2025-04-09T23:15:05.887060Z" |
| 24 | + "iopub.execute_input": "2025-04-18T08:29:30.293505Z", |
| 25 | + "iopub.status.busy": "2025-04-18T08:29:30.293403Z", |
| 26 | + "iopub.status.idle": "2025-04-18T08:29:30.540217Z", |
| 27 | + "shell.execute_reply": "2025-04-18T08:29:30.539905Z" |
36 | 28 | }
|
37 | 29 | },
|
38 | 30 | "outputs": [],
|
|
42 | 34 | },
|
43 | 35 | {
|
44 | 36 | "cell_type": "markdown",
|
45 |
| - "id": "f8aade2f", |
| 37 | + "id": "ad381e0c", |
46 | 38 | "metadata": {},
|
47 | 39 | "source": [
|
48 | 40 | "Or import it implicitly after importing pandas:\n",
|
|
55 | 47 | },
|
56 | 48 | {
|
57 | 49 | "cell_type": "markdown",
|
58 |
| - "id": "71961e92", |
| 50 | + "id": "0d715aa4", |
59 | 51 | "metadata": {},
|
60 | 52 | "source": [
|
61 | 53 | "### Data\n",
|
|
65 | 57 | {
|
66 | 58 | "cell_type": "code",
|
67 | 59 | "execution_count": 2,
|
68 |
| - "id": "e9c3dbaa", |
| 60 | + "id": "f633cab9", |
69 | 61 | "metadata": {
|
70 | 62 | "execution": {
|
71 |
| - "iopub.execute_input": "2025-04-09T23:15:05.889445Z", |
72 |
| - "iopub.status.busy": "2025-04-09T23:15:05.889287Z", |
73 |
| - "iopub.status.idle": "2025-04-09T23:15:05.892493Z", |
74 |
| - "shell.execute_reply": "2025-04-09T23:15:05.892125Z" |
| 63 | + "iopub.execute_input": "2025-04-18T08:29:30.542200Z", |
| 64 | + "iopub.status.busy": "2025-04-18T08:29:30.542036Z", |
| 65 | + "iopub.status.idle": "2025-04-18T08:29:30.545306Z", |
| 66 | + "shell.execute_reply": "2025-04-18T08:29:30.545014Z" |
75 | 67 | }
|
76 | 68 | },
|
77 | 69 | "outputs": [],
|
|
108 | 100 | },
|
109 | 101 | {
|
110 | 102 | "cell_type": "markdown",
|
111 |
| - "id": "d76c7c78", |
| 103 | + "id": "f2856816", |
112 | 104 | "metadata": {},
|
113 | 105 | "source": [
|
114 | 106 | "Here is the original rendering of the DataFrame. It's a simple table with no formatting or styling. It's not very readable, and the data is not very visually appealing."
|
|
117 | 109 | {
|
118 | 110 | "cell_type": "code",
|
119 | 111 | "execution_count": 3,
|
120 |
| - "id": "da750110", |
| 112 | + "id": "f2396934", |
121 | 113 | "metadata": {
|
122 | 114 | "execution": {
|
123 |
| - "iopub.execute_input": "2025-04-09T23:15:05.893902Z", |
124 |
| - "iopub.status.busy": "2025-04-09T23:15:05.893802Z", |
125 |
| - "iopub.status.idle": "2025-04-09T23:15:05.900891Z", |
126 |
| - "shell.execute_reply": "2025-04-09T23:15:05.900647Z" |
| 115 | + "iopub.execute_input": "2025-04-18T08:29:30.546734Z", |
| 116 | + "iopub.status.busy": "2025-04-18T08:29:30.546637Z", |
| 117 | + "iopub.status.idle": "2025-04-18T08:29:30.555636Z", |
| 118 | + "shell.execute_reply": "2025-04-18T08:29:30.555380Z" |
127 | 119 | }
|
128 | 120 | },
|
129 | 121 | "outputs": [
|
|
216 | 208 | },
|
217 | 209 | {
|
218 | 210 | "cell_type": "markdown",
|
219 |
| - "id": "2ce9de38", |
| 211 | + "id": "43dcf205", |
220 | 212 | "metadata": {},
|
221 | 213 | "source": [
|
222 | 214 | "### Rendering\n",
|
|
226 | 218 | {
|
227 | 219 | "cell_type": "code",
|
228 | 220 | "execution_count": 4,
|
229 |
| - "id": "ddf0a87a", |
| 221 | + "id": "351b70e6", |
230 | 222 | "metadata": {
|
231 | 223 | "execution": {
|
232 |
| - "iopub.execute_input": "2025-04-09T23:15:05.902207Z", |
233 |
| - "iopub.status.busy": "2025-04-09T23:15:05.902096Z", |
234 |
| - "iopub.status.idle": "2025-04-09T23:15:05.909596Z", |
235 |
| - "shell.execute_reply": "2025-04-09T23:15:05.909299Z" |
| 224 | + "iopub.execute_input": "2025-04-18T08:29:30.557067Z", |
| 225 | + "iopub.status.busy": "2025-04-18T08:29:30.556928Z", |
| 226 | + "iopub.status.idle": "2025-04-18T08:29:30.564057Z", |
| 227 | + "shell.execute_reply": "2025-04-18T08:29:30.563756Z" |
236 | 228 | }
|
237 | 229 | },
|
238 | 230 | "outputs": [
|
|
267 | 259 | },
|
268 | 260 | {
|
269 | 261 | "cell_type": "markdown",
|
270 |
| - "id": "5ef2c3ac", |
| 262 | + "id": "5c9cc573", |
271 | 263 | "metadata": {},
|
272 | 264 | "source": [
|
273 | 265 | "### Filtering and Ordering\n",
|
|
277 | 269 | {
|
278 | 270 | "cell_type": "code",
|
279 | 271 | "execution_count": 5,
|
280 |
| - "id": "db762efb", |
| 272 | + "id": "0f4f02db", |
281 | 273 | "metadata": {
|
282 | 274 | "execution": {
|
283 |
| - "iopub.execute_input": "2025-04-09T23:15:05.910954Z", |
284 |
| - "iopub.status.busy": "2025-04-09T23:15:05.910857Z", |
285 |
| - "iopub.status.idle": "2025-04-09T23:15:05.915410Z", |
286 |
| - "shell.execute_reply": "2025-04-09T23:15:05.915146Z" |
| 275 | + "iopub.execute_input": "2025-04-18T08:29:30.565390Z", |
| 276 | + "iopub.status.busy": "2025-04-18T08:29:30.565294Z", |
| 277 | + "iopub.status.idle": "2025-04-18T08:29:30.569915Z", |
| 278 | + "shell.execute_reply": "2025-04-18T08:29:30.569630Z" |
287 | 279 | },
|
288 | 280 | "lines_to_next_cell": 2
|
289 | 281 | },
|
|
317 | 309 | },
|
318 | 310 | {
|
319 | 311 | "cell_type": "markdown",
|
320 |
| - "id": "9edda3ec", |
| 312 | + "id": "b33b7b0f", |
321 | 313 | "metadata": {},
|
322 | 314 | "source": [
|
323 | 315 | "### Dynamic Placeholder\n",
|
|
328 | 320 | {
|
329 | 321 | "cell_type": "code",
|
330 | 322 | "execution_count": 6,
|
331 |
| - "id": "e37324a3", |
| 323 | + "id": "74b26e4a", |
332 | 324 | "metadata": {
|
333 | 325 | "execution": {
|
334 |
| - "iopub.execute_input": "2025-04-09T23:15:05.916698Z", |
335 |
| - "iopub.status.busy": "2025-04-09T23:15:05.916602Z", |
336 |
| - "iopub.status.idle": "2025-04-09T23:15:05.922364Z", |
337 |
| - "shell.execute_reply": "2025-04-09T23:15:05.922104Z" |
| 326 | + "iopub.execute_input": "2025-04-18T08:29:30.571157Z", |
| 327 | + "iopub.status.busy": "2025-04-18T08:29:30.571063Z", |
| 328 | + "iopub.status.idle": "2025-04-18T08:29:30.577175Z", |
| 329 | + "shell.execute_reply": "2025-04-18T08:29:30.576889Z" |
338 | 330 | }
|
339 | 331 | },
|
340 | 332 | "outputs": [
|
|
415 | 407 | },
|
416 | 408 | {
|
417 | 409 | "cell_type": "markdown",
|
418 |
| - "id": "80974ebd", |
| 410 | + "id": "171615fe", |
419 | 411 | "metadata": {},
|
420 | 412 | "source": [
|
421 | 413 | "### Gallery\n",
|
|
425 | 417 | {
|
426 | 418 | "cell_type": "code",
|
427 | 419 | "execution_count": 7,
|
428 |
| - "id": "4dc6eb5f", |
| 420 | + "id": "34d09fdd", |
429 | 421 | "metadata": {
|
430 | 422 | "execution": {
|
431 |
| - "iopub.execute_input": "2025-04-09T23:15:05.923691Z", |
432 |
| - "iopub.status.busy": "2025-04-09T23:15:05.923606Z", |
433 |
| - "iopub.status.idle": "2025-04-09T23:15:05.927855Z", |
434 |
| - "shell.execute_reply": "2025-04-09T23:15:05.927566Z" |
| 423 | + "iopub.execute_input": "2025-04-18T08:29:30.578645Z", |
| 424 | + "iopub.status.busy": "2025-04-18T08:29:30.578521Z", |
| 425 | + "iopub.status.idle": "2025-04-18T08:29:30.582906Z", |
| 426 | + "shell.execute_reply": "2025-04-18T08:29:30.582620Z" |
435 | 427 | }
|
436 | 428 | },
|
437 | 429 | "outputs": [
|
|
0 commit comments