Feat: Eval with or without date

This commit is contained in:
Bertrand Benjamin 2019-08-04 19:28:43 +02:00
parent daf24ec90e
commit 7119fcdcdc

View File

@ -2,18 +2,20 @@
"cells": [
{
"cell_type": "code",
"execution_count": 37,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import Markdown as md\n",
"from IPython.display import DisplayHandle\n",
"import pandas as pd\n",
"from pathlib import Path"
"from pathlib import Path\n",
"from datetime import datetime"
]
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": 8,
"metadata": {
"tags": [
"parameters"
@ -28,25 +30,43 @@
},
{
"cell_type": "code",
"execution_count": 39,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"split_ass = assessment.split(\"_\")\n",
"if len(split_ass) > 1:\n",
" date, *assessment = assessment.split(\"_\")\n",
" date = datetime.strptime(date, \"%y%m%d\")\n",
" assessment = ' '.join(assessment)\n",
"else:\n",
" date = None\n",
" assessment = split_ass[0]"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"# Ds1 pour 308"
"# dm2 (14/11/2016) pour 308"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
"output_type": "display_data"
}
],
"source": [
"md(f\"# {assessment} pour {tribe}\")"
"if date is None:\n",
" display(md(f\"# {assessment} pour {tribe}\"))\n",
"else:\n",
" display(md(f\"# {assessment} ({date:%d/%m/%Y}) pour {tribe}\"))"
]
},
{
@ -74,7 +94,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.7.4"
}
},
"nbformat": 4,