Skip to content

Commit fe7b037

Browse files
fix deepnote link
1 parent 7638ea1 commit fe7b037

File tree

3 files changed

+399
-26112
lines changed

3 files changed

+399
-26112
lines changed

productive_tools/pipe.ipynb

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"source": "[![View on GitHub](https://img.shields.io/badge/GitHub-View_on_GitHub-blue?logo=GitHub)](https://github.com/khuyentran1401/Data-science/blob/master/productive_tools/pipe.ipynb)\n\n[<img src=\"https://deepnote.com/buttons/launch-in-deepnote.svg\">](/work/Data-science/productive_tools/pipe.ipynb)",
5+
"source": "[![View on GitHub](https://img.shields.io/badge/GitHub-View_on_GitHub-blue?logo=GitHub)](https://github.com/khuyentran1401/Data-science/blob/master/productive_tools/pipe.ipynb)\n\n[<img src=\"https://deepnote.com/buttons/launch-in-deepnote.svg\">](https://deepnote.com/project/Data-science-hxlyJpi-QrKFJziQgoMSmQ/%2FData-science%2Fproductive_tools%2Fpipe.ipynb)",
66
"metadata": {
77
"tags": [],
88
"cell_id": "00000-2c4341ee-abf7-4f9b-af8d-48afb0d90081",
99
"deepnote_cell_type": "markdown"
10-
},
11-
"outputs": [],
12-
"execution_count": null
10+
}
1311
},
1412
{
1513
"cell_type": "code",
@@ -52,7 +50,7 @@
5250
"deepnote_cell_type": "code"
5351
},
5452
"source": "from pipe import where",
55-
"execution_count": 1,
53+
"execution_count": null,
5654
"outputs": []
5755
},
5856
{
@@ -66,7 +64,7 @@
6664
"deepnote_cell_type": "code"
6765
},
6866
"source": "arr = [1, 2, 3, 4, 5]\n\n# filter using list comprehension\n[x for x in arr if x % 2 == 0]",
69-
"execution_count": 2,
67+
"execution_count": null,
7068
"outputs": [
7169
{
7270
"data": {
@@ -89,7 +87,7 @@
8987
"deepnote_cell_type": "code"
9088
},
9189
"source": "# filter using pipe\nlist(arr | where(lambda x: x % 2 == 0))",
92-
"execution_count": 3,
90+
"execution_count": null,
9391
"outputs": [
9492
{
9593
"data": {
@@ -120,7 +118,7 @@
120118
"deepnote_cell_type": "code"
121119
},
122120
"source": "from pipe import select",
123-
"execution_count": 2,
121+
"execution_count": null,
124122
"outputs": []
125123
},
126124
{
@@ -134,7 +132,7 @@
134132
"deepnote_cell_type": "code"
135133
},
136134
"source": "arr = [1, 2, 3, 4, 5]",
137-
"execution_count": 45,
135+
"execution_count": null,
138136
"outputs": [
139137
{
140138
"data": {
@@ -157,7 +155,7 @@
157155
"deepnote_cell_type": "code"
158156
},
159157
"source": "list(arr | select(lambda x: x * 2))",
160-
"execution_count": 47,
158+
"execution_count": null,
161159
"outputs": [
162160
{
163161
"data": {
@@ -188,7 +186,7 @@
188186
"deepnote_cell_type": "code"
189187
},
190188
"source": "# Instead of this\nlist(map(lambda x: x * 2, filter(lambda x: x % 2 == 0, arr)))",
191-
"execution_count": 46,
189+
"execution_count": null,
192190
"outputs": [
193191
{
194192
"data": {
@@ -219,7 +217,7 @@
219217
"deepnote_cell_type": "code"
220218
},
221219
"source": "# use pipe\nlist(arr | where(lambda x: x % 2 == 0) | select(lambda x: x * 2))",
222-
"execution_count": 7,
220+
"execution_count": null,
223221
"outputs": [
224222
{
225223
"data": {
@@ -242,7 +240,7 @@
242240
"deepnote_cell_type": "code"
243241
},
244242
"source": "# the order matters\nlist(arr | select(lambda x: x * 2) | where(lambda x: x % 2 == 0))",
245-
"execution_count": 8,
243+
"execution_count": null,
246244
"outputs": [
247245
{
248246
"data": {
@@ -281,7 +279,7 @@
281279
"deepnote_cell_type": "code"
282280
},
283281
"source": "from pipe import chain",
284-
"execution_count": 28,
282+
"execution_count": null,
285283
"outputs": [
286284
{
287285
"data": {
@@ -304,7 +302,7 @@
304302
"deepnote_cell_type": "code"
305303
},
306304
"source": "nested = [[1, 2, [3]], [4, 5]]\nlist(nested | chain)",
307-
"execution_count": 48,
305+
"execution_count": null,
308306
"outputs": [
309307
{
310308
"data": {
@@ -343,7 +341,7 @@
343341
"deepnote_cell_type": "code"
344342
},
345343
"source": "from pipe import traverse",
346-
"execution_count": 49,
344+
"execution_count": null,
347345
"outputs": [
348346
{
349347
"data": {
@@ -366,7 +364,7 @@
366364
"deepnote_cell_type": "code"
367365
},
368366
"source": "list(nested | traverse)",
369-
"execution_count": 50,
367+
"execution_count": null,
370368
"outputs": [
371369
{
372370
"data": {
@@ -397,7 +395,7 @@
397395
"deepnote_cell_type": "code"
398396
},
399397
"source": "fruits = [\n {\"name\": \"apple\", \"price\": [2, 5]},\n {\"name\": \"orange\", \"price\": 4},\n {\"name\": \"grape\", \"price\": 5},\n]",
400-
"execution_count": 27,
398+
"execution_count": null,
401399
"outputs": [
402400
{
403401
"data": {
@@ -420,7 +418,7 @@
420418
"deepnote_cell_type": "code"
421419
},
422420
"source": "list(fruits | select(lambda fruit: fruit[\"price\"]) | traverse)",
423-
"execution_count": 36,
421+
"execution_count": null,
424422
"outputs": [
425423
{
426424
"data": {
@@ -459,7 +457,7 @@
459457
"deepnote_cell_type": "code"
460458
},
461459
"source": "from pipe import groupby",
462-
"execution_count": 3,
460+
"execution_count": null,
463461
"outputs": []
464462
},
465463
{
@@ -474,7 +472,7 @@
474472
"deepnote_cell_type": "code"
475473
},
476474
"source": "list(\n (1, 2, 3, 4, 5, 6, 7, 8, 9)\n | groupby(lambda x: \"Even\" if x % 2==0 else \"Odd\")\n | select(lambda x: {x[0]: list(x[1])})\n)",
477-
"execution_count": 11,
475+
"execution_count": null,
478476
"outputs": [
479477
{
480478
"data": {
@@ -497,7 +495,7 @@
497495
"deepnote_cell_type": "code"
498496
},
499497
"source": "list(\n (1, 2, 3, 4, 5, 6, 7, 8, 9)\n | groupby(lambda x: \"Even\" if x % 2==0 else \"Odd\")\n | select(lambda x: {x[0]: list(x[1] | where(lambda x: x > 2))})\n)",
500-
"execution_count": 12,
498+
"execution_count": null,
501499
"outputs": [
502500
{
503501
"data": {
@@ -528,7 +526,7 @@
528526
"deepnote_cell_type": "code"
529527
},
530528
"source": "from pipe import dedup\n\narr = [1, 2, 2, 3, 4, 5, 6, 6, 7, 9, 3, 3, 1]",
531-
"execution_count": 15,
529+
"execution_count": null,
532530
"outputs": [
533531
{
534532
"data": {
@@ -551,7 +549,7 @@
551549
"deepnote_cell_type": "code"
552550
},
553551
"source": "list(arr | dedup)",
554-
"execution_count": 33,
552+
"execution_count": null,
555553
"outputs": [
556554
{
557555
"data": {
@@ -574,7 +572,7 @@
574572
"deepnote_cell_type": "code"
575573
},
576574
"source": "# Get one element that is smaller than 5 and one element that is larger than or equal to 5\nlist(arr | dedup(lambda key: key < 5))",
577-
"execution_count": 26,
575+
"execution_count": null,
578576
"outputs": [
579577
{
580578
"data": {
@@ -605,7 +603,7 @@
605603
"deepnote_cell_type": "code"
606604
},
607605
"source": "data = [\n {\"name\": \"apple\", \"count\": 2},\n {\"name\": \"orange\", \"count\": 4},\n {\"name\": \"grape\", \"count\": None},\n {\"name\": \"orange\", \"count\": 7},\n]",
608-
"execution_count": 12,
606+
"execution_count": null,
609607
"outputs": [
610608
{
611609
"data": {
@@ -628,7 +626,7 @@
628626
"deepnote_cell_type": "code"
629627
},
630628
"source": "list(\n data\n | dedup(key=lambda fruit: fruit[\"name\"])\n | select(lambda fruit: fruit[\"count\"])\n | where(lambda count: isinstance(count, int))\n)",
631-
"execution_count": 16,
629+
"execution_count": null,
632630
"outputs": [
633631
{
634632
"data": {

0 commit comments

Comments
 (0)