Skip to content

Commit

Permalink
feat: update template
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentLvr committed Nov 16, 2023
1 parent b6c0f5d commit 8a38af2
Showing 1 changed file with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"tags": []
},
"source": [
"# Datetime - Get weekday"
"# Datetime - Get the weekday of the current date"
]
},
{
Expand Down Expand Up @@ -63,7 +63,7 @@
"tags": []
},
"source": [
"**Description:** This notebook will show how to get the weekday from a given date using the datetime library. It is usefull for organizations to quickly get the weekday from a given date."
"**Description:** This notebook will get the weekday of the current date: Monday is 0 and Sunday is 6."
]
},
{
Expand All @@ -74,7 +74,9 @@
"tags": []
},
"source": [
"**References:**\n- [Python datetime library](https://docs.python.org/3/library/datetime.html)\n- [Python datetime strftime](https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior)"
"**References:**\n",
"- [Python datetime library](https://docs.python.org/3/library/datetime.html)\n",
"- [Python datetime strftime](https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior)"
]
},
{
Expand Down Expand Up @@ -107,8 +109,10 @@
"papermill": {},
"tags": []
},
"source": "import datetime",
"outputs": []
"outputs": [],
"source": [
"import datetime"
]
},
{
"cell_type": "markdown",
Expand All @@ -118,7 +122,8 @@
"tags": []
},
"source": [
"### Setup variables\n- `date`: date to get the weekday from"
"### Setup variables\n",
"- `today`: date to get the weekday from"
]
},
{
Expand All @@ -129,8 +134,10 @@
"papermill": {},
"tags": []
},
"source": "date = datetime.date(2023, 11, 16)",
"outputs": []
"outputs": [],
"source": [
"today = datetime.date.today()"
]
},
{
"cell_type": "markdown",
Expand All @@ -154,17 +161,6 @@
"### Get weekday"
]
},
{
"cell_type": "markdown",
"id": "e2eca223-25bc-4a7b-bef3-dc918f5e40f2",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"Long description of the function: This function will get the weekday from a given date using the datetime library."
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -173,8 +169,10 @@
"papermill": {},
"tags": []
},
"source": "weekday = date.strftime(\"%A\")",
"outputs": []
"outputs": [],
"source": [
"weekday = today.weekday()"
]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -206,8 +204,10 @@
"papermill": {},
"tags": []
},
"source": "print(f\"The weekday of {date} is {weekday}\")",
"outputs": []
"outputs": [],
"source": [
"print(f\"The weekday of {today} is {today.strftime('%A')} ({weekday})\")"
]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -249,4 +249,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}

0 comments on commit 8a38af2

Please sign in to comment.