Skip to content

Commit

Permalink
Add Basic data structures chapter and create two notebooks for series…
Browse files Browse the repository at this point in the history
… and data frames
  • Loading branch information
DrSaadLa committed Jan 6, 2024
1 parent cd2e8d5 commit 23f702d
Show file tree
Hide file tree
Showing 4 changed files with 290 additions and 9 deletions.
92 changes: 92 additions & 0 deletions Tutorials/02_BasicDataStructures/1_Series.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "4a699447-f6c2-4385-a32e-4db8f5202d01",
"metadata": {},
"source": [
"<div style=\"text-align:center;font-size:22pt; font-weight:bold;color:white;border:solid black 1.5pt;background-color:#1e7263;\">\n",
" Basic Data Structures with Polars <br> \n",
" Series\n",
"</div>"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "c34b1ebb-1849-4b6c-bbd4-a66919a78008",
"metadata": {},
"outputs": [],
"source": [
"# ============================================================\n",
"# =\n",
"# Title: Basic Data Structures with Polars =\n",
"# Series =\n",
"# --------------------------------- =\n",
"# =\n",
"# Author: Dr. Saad Laouadi =\n",
"# =\n",
"# Copyright: Dr. Saad Laouadi =\n",
"# ============================================================\n",
"# =\n",
"# LICENSE =\n",
"# ---------------------- =\n",
"# =\n",
"# This material is intended for educational =\n",
"# purposes only and may not be used directly in =\n",
"# courses, video recordings, or similar =\n",
"# without prior consent from the author. =\n",
"# When using or referencing this material, =\n",
"# proper credit must be attributed to the =\n",
"# author. =\n",
"# ============================================================"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "7a9be308-bfec-44e1-b2f6-14187eba305e",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"# Environment Setup\n",
"import sys\n",
"sys.path.append('../../scripts/') \n",
"\n",
"# import the working libraries\n",
"from importlibs import *"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "889cdc44-6fd2-4ea6-97a9-e63040f3aca6",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "PolarsEnv",
"language": "python",
"name": "plenv"
},
"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.12.1"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
121 changes: 121 additions & 0 deletions Tutorials/02_BasicDataStructures/2_DataFrames.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "4a699447-f6c2-4385-a32e-4db8f5202d01",
"metadata": {},
"source": [
"<div style=\"text-align:center;font-size:22pt; font-weight:bold;color:white;border:solid black 1.5pt;background-color:#1e7263;\">\n",
" Basic Data Structures with Polars <br> \n",
" DataFrames\n",
"</div>"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "c34b1ebb-1849-4b6c-bbd4-a66919a78008",
"metadata": {},
"outputs": [],
"source": [
"# ============================================================\n",
"# =\n",
"# Title: Basic Data Structures with Polars =\n",
"# Data Frames =\n",
"# --------------------------------- =\n",
"# =\n",
"# Author: Dr. Saad Laouadi =\n",
"# =\n",
"# Copyright: Dr. Saad Laouadi =\n",
"# ============================================================\n",
"# =\n",
"# LICENSE =\n",
"# ---------------------- =\n",
"# =\n",
"# This material is intended for educational =\n",
"# purposes only and may not be used directly in =\n",
"# courses, video recordings, or similar =\n",
"# without prior consent from the author. =\n",
"# When using or referencing this material, =\n",
"# proper credit must be attributed to the =\n",
"# author. =\n",
"# ============================================================"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "7a9be308-bfec-44e1-b2f6-14187eba305e",
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"******************************************\n",
" The imported libs are: \n",
"******************************************\n",
"polars version is : 0.20.2\n",
"pandas version is : 2.1.4\n",
"numpy version is : 1.26.2\n",
"pyarrow version is: 14.0.2\n",
"******************************************\n",
"The imported builtin modules are:\n",
"['os', 'sys', 'pathlib', 'time', 'shutil', 're']\n",
"**************************************************************\n",
"The python executable path is:\n",
" /usr/local/Caskroom/mambaforge/base/envs/plenv/bin/python3.12\n",
"**************************************************************\n",
"\n",
"....................\n",
"Important Reminder:\n",
"....................\n",
"\n",
"Before proceeding, please ensure that you have activated the appropriate virtual environment for this project.\n",
"This step is crucial to maintain consistent dependencies and project settings.\n",
"...............................................................................\n"
]
}
],
"source": [
"# Environment Setup\n",
"import sys\n",
"sys.path.append('../../scripts/') \n",
"\n",
"# import the working libraries\n",
"from importlibs import *"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "889cdc44-6fd2-4ea6-97a9-e63040f3aca6",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "PolarsEnv",
"language": "python",
"name": "plenv"
},
"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.12.1"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"id": "81bdbb95-7e4c-4765-a561-f5986649bc1a",
"metadata": {},
"source": [
"# Reading Comma Separated Value Data "
"<div style=\"text-align:center;font-size:22pt; font-weight:bold;color:white;border:solid black 1.5pt;background-color:#1e7263;\">\n",
" Reading Comma Separated Value Data (CSV)\n",
"</div>"
]
},
{
Expand All @@ -17,8 +19,68 @@
},
"outputs": [],
"source": [
"# Environment setup\n",
"import polars as pl"
"# ============================================================\n",
"# =\n",
"# Title: Reading CSV Data with Polars =\n",
"# --------------------------------- =\n",
"# =\n",
"# Author: Dr. Saad Laouadi =\n",
"# =\n",
"# Copyright: Dr. Saad Laouadi =\n",
"# ============================================================\n",
"# =\n",
"# LICENSE =\n",
"# ---------------------- =\n",
"# =\n",
"# This material is intended for educational =\n",
"# purposes only and may not be used directly in =\n",
"# courses, video recordings, or similar =\n",
"# without prior consent from the author. =\n",
"# When using or referencing this material, =\n",
"# proper credit must be attributed to the =\n",
"# author. =\n",
"# ============================================================"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "030a2ad2-df5b-4812-bca5-c9f7cdf96540",
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"******************************************\n",
" The imported libs are: \n",
"******************************************\n",
"polars version is : 0.20.2\n",
"pandas version is : 2.1.4\n",
"numpy version is : 1.26.2\n",
"pyarrow version is: 14.0.2\n",
"******************************************\n",
"The imported builtin modules are:\n",
"['os', 'sys', 'pathlib', 'time', 'shutil', 're']\n",
"**************************************************************\n",
"The python executable path is:\n",
" /usr/local/Caskroom/mambaforge/base/envs/plenv/bin/python3.12\n",
"**************************************************************\n",
"Important Reminder:\n",
"Before proceeding, please ensure that you have activated the appropriate virtual environment for this project.\n",
"This step is crucial to maintain consistent dependencies and project settings.\n"
]
}
],
"source": [
"# Environment Setup\n",
"import sys\n",
"sys.path.append('../../scripts/') \n",
"\n",
"# import the working libraries\n",
"from importlibs import *"
]
},
{
Expand Down Expand Up @@ -518,9 +580,9 @@
}
],
"source": [
"for meth in dir(pl):\n",
" if not meth.startswith('_'):\n",
" print(meth)"
"# for meth in dir(pl):\n",
"# if not meth.startswith('_'):\n",
"# print(meth)"
]
},
{
Expand Down
12 changes: 9 additions & 3 deletions scripts/importlibs.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ def typewriter_message(message, delay=0.01):
time.sleep(delay)
print()


message = "Important Reminder:\nBefore proceeding, please ensure that you have activated the appropriate virtual environment for this project.\nThis step is crucial to maintain consistent dependencies and project settings."
print()

typewriter_message("."*20)
typewriter_message("Important Reminder:")
typewriter_message("."*20)

message = "\nBefore proceeding, please ensure that you have activated the appropriate virtual environment for this project.\nThis step is crucial to maintain consistent dependencies and project settings."

typewriter_message(message)
typewriter_message(message)
typewriter_message("."*79)

0 comments on commit 23f702d

Please sign in to comment.