actually remove Python notebooks
This commit is contained in:
@@ -1,86 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "4f76fe31-46f7-4252-8a57-f6689d2ab9c7",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import polars as pl\n",
|
||||
"data = pl.from_repr(\"\"\"\n",
|
||||
"┌─────────────────────┬─────────────────────┬─────┐\n",
|
||||
"│ arrival_time ┆ departure_time ┆ ID │\n",
|
||||
"│ --- ┆ --- ┆ --- │\n",
|
||||
"│ datetime[μs] ┆ datetime[μs] ┆ str │\n",
|
||||
"╞═════════════════════╪═════════════════════╪═════╡\n",
|
||||
"│ 2023-01-01 06:23:47 ┆ 2023-01-01 06:25:08 ┆ A1 │\n",
|
||||
"│ 2023-01-01 06:26:42 ┆ 2023-01-01 06:28:02 ┆ A1 │\n",
|
||||
"│ 2023-01-01 06:30:20 ┆ 2023-01-01 06:35:01 ┆ A5 │\n",
|
||||
"│ 2023-01-01 06:32:06 ┆ 2023-01-01 06:33:48 ┆ A6 │\n",
|
||||
"│ 2023-01-01 06:33:09 ┆ 2023-01-01 06:36:01 ┆ B3 │\n",
|
||||
"│ 2023-01-01 06:34:08 ┆ 2023-01-01 06:39:49 ┆ C3 │\n",
|
||||
"│ 2023-01-01 06:36:40 ┆ 2023-01-01 06:38:34 ┆ A6 │\n",
|
||||
"│ 2023-01-01 06:37:43 ┆ 2023-01-01 06:40:48 ┆ A5 │\n",
|
||||
"│ 2023-01-01 06:39:48 ┆ 2023-01-01 06:46:10 ┆ A6 │\n",
|
||||
"└─────────────────────┴─────────────────────┴─────┘\n",
|
||||
"\"\"\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"id": "a98af5f2-3dfb-405e-9654-62e8c623e683",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"['A1', 'A1', 'A5', 'A6', 'B3', 'C3', 'A6', 'A5', 'A6']\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(data.to_series(2).cast(pl.Utf8).to_list())"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "218be411-1e32-4374-8e73-0d9c40f133fe",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"df = pl.DataFrame({'a': [1,2,3], 'b': [4,5,6] , \"c\" : [6,7,8]})"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.9"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
204
Untitled1.ipynb
204
Untitled1.ipynb
@@ -1,204 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "5be6be9d-cb59-4833-b5d2-d485b48ab605",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import polars as pl\n",
|
||||
"df = pl.DataFrame({'a': [1,2,3], 'b': [4,5,6] , \"c\" : [6,7,8]})"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "cbeac661-6bf5-4736-ac47-018b89ce178e",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div><style>\n",
|
||||
".dataframe > thead > tr > th,\n",
|
||||
".dataframe > tbody > tr > td {\n",
|
||||
" text-align: right;\n",
|
||||
"}\n",
|
||||
"</style>\n",
|
||||
"<small>shape: (3, 1)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>sum</th></tr><tr><td>i64</td></tr></thead><tbody><tr><td>11</td></tr><tr><td>14</td></tr><tr><td>17</td></tr></tbody></table></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"shape: (3, 1)\n",
|
||||
"┌─────┐\n",
|
||||
"│ sum │\n",
|
||||
"│ --- │\n",
|
||||
"│ i64 │\n",
|
||||
"╞═════╡\n",
|
||||
"│ 11 │\n",
|
||||
"│ 14 │\n",
|
||||
"│ 17 │\n",
|
||||
"└─────┘"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"df.select(pl.sum(df))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "23533f07-b063-4e0b-b429-3b822b7f8da3",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div><style>\n",
|
||||
".dataframe > thead > tr > th,\n",
|
||||
".dataframe > tbody > tr > td {\n",
|
||||
" text-align: right;\n",
|
||||
"}\n",
|
||||
"</style>\n",
|
||||
"<small>shape: (1, 3)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>a</th><th>b</th><th>c</th></tr><tr><td>list[i64]</td><td>list[i64]</td><td>list[i64]</td></tr></thead><tbody><tr><td>[1, 2, 3]</td><td>[4, 5, 6]</td><td>[6, 7, 8]</td></tr></tbody></table></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"shape: (1, 3)\n",
|
||||
"┌───────────┬───────────┬───────────┐\n",
|
||||
"│ a ┆ b ┆ c │\n",
|
||||
"│ --- ┆ --- ┆ --- │\n",
|
||||
"│ list[i64] ┆ list[i64] ┆ list[i64] │\n",
|
||||
"╞═══════════╪═══════════╪═══════════╡\n",
|
||||
"│ [1, 2, 3] ┆ [4, 5, 6] ┆ [6, 7, 8] │\n",
|
||||
"└───────────┴───────────┴───────────┘"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"df.select(pl.implode(df.columns))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"id": "6132a9de-bbfe-4dea-a38c-321ec96ba7f9",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"shape: (3,)\n",
|
||||
"Series: '' [o][object]\n",
|
||||
"[\n",
|
||||
"\t{'a': '0', 'b': 0}\n",
|
||||
"\t{'a': '1', 'b': 1}\n",
|
||||
"\t{'a': '2', 'b': 2}\n",
|
||||
"]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import polars as pl\n",
|
||||
"# force use object here for demo, custom object in real production\n",
|
||||
"s=pl.Series([0,1,2], dtype=pl.Object) \n",
|
||||
"\n",
|
||||
"print(s.apply(lambda x: {\"a\":str(x), \"b\":x}, return_dtype=pl.Object))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"id": "e3380d33-34a4-48ba-a1ee-aa2682d5e678",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data = pl.DataFrame(\n",
|
||||
" {'geo': [\"[[-99.134,19.401],[-98.234,16.403],[-99.432,19.401]]\",\n",
|
||||
" \"[[-99.1962,19.401],[-95.196,19.345]]\",\n",
|
||||
" \"[[-93.196,19.401],[-94.196,19.401],[-99.196,19.401],[-99.196,19.401]]\"]})"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"id": "07a4e50f-e763-478d-a017-72cd00d74302",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div><style>\n",
|
||||
".dataframe > thead > tr > th,\n",
|
||||
".dataframe > tbody > tr > td {\n",
|
||||
" text-align: right;\n",
|
||||
"}\n",
|
||||
"</style>\n",
|
||||
"<small>shape: (3, 1)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>geo</th></tr><tr><td>list[str]</td></tr></thead><tbody><tr><td>["[[-99.134", "19.401]", … "19.401]]"]</td></tr><tr><td>["[[-99.1962", "19.401]", … "19.345]]"]</td></tr><tr><td>["[[-93.196", "19.401]", … "19.401]]"]</td></tr></tbody></table></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"shape: (3, 1)\n",
|
||||
"┌───────────────────────────────────┐\n",
|
||||
"│ geo │\n",
|
||||
"│ --- │\n",
|
||||
"│ list[str] │\n",
|
||||
"╞═══════════════════════════════════╡\n",
|
||||
"│ [\"[[-99.134\", \"19.401]\", … \"19.4… │\n",
|
||||
"│ [\"[[-99.1962\", \"19.401]\", … \"19.… │\n",
|
||||
"│ [\"[[-93.196\", \"19.401]\", … \"19.4… │\n",
|
||||
"└───────────────────────────────────┘"
|
||||
]
|
||||
},
|
||||
"execution_count": 19,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"data.with_columns(pl.col(\"geo\").str.split(\",\").list.eval(pl.element().str.split(\")"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.9"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Reference in New Issue
Block a user