From d975d5935d45552bb2e4dad3b90951ac585b98bb Mon Sep 17 00:00:00 2001 From: Nemanja <55772835+nemanjarajic@users.noreply.github.com> Date: Mon, 26 Feb 2024 10:57:29 -0800 Subject: [PATCH] python heart classifier samples update pandas (#3019) * samples update * run black and fix --- .../mlflow-for-batch-tabular.ipynb | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/sdk/python/endpoints/batch/deploy-models/heart-classifier-mlflow/mlflow-for-batch-tabular.ipynb b/sdk/python/endpoints/batch/deploy-models/heart-classifier-mlflow/mlflow-for-batch-tabular.ipynb index fa63e2135ac..9b77710ae34 100644 --- a/sdk/python/endpoints/batch/deploy-models/heart-classifier-mlflow/mlflow-for-batch-tabular.ipynb +++ b/sdk/python/endpoints/batch/deploy-models/heart-classifier-mlflow/mlflow-for-batch-tabular.ipynb @@ -824,9 +824,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "We can read this data using pandas library:\n", - "\n", - "> Tip: Notice how the CSV is read as opposite to use directly `pd.read_csv`." + "We can read this CSV file using the `pandas` library:" ] }, { @@ -846,15 +844,11 @@ }, "outputs": [], "source": [ - "from ast import literal_eval\n", "import pandas as pd\n", "\n", - "with open(\"named-outputs/score/predictions.csv\", \"r\") as f:\n", - " data = f.read()\n", - " score = pd.DataFrame(\n", - " literal_eval(data.replace(\"\\n\", \",\")), columns=[\"file\", \"prediction\"]\n", - " )\n", - "score" + "score = pd.read_csv(\n", + " \"named-outputs/score/predictions.csv\", names=[\"row\", \"prediction\", \"file\"]\n", + ")" ] }, { @@ -1049,9 +1043,9 @@ "name": "python310-sdkv2" }, "kernelspec": { - "display_name": "previews", + "display_name": "env", "language": "python", - "name": "previews" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -1063,7 +1057,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.5" + "version": "3.10.11" }, "microsoft": { "ms_spell_check": { @@ -1072,11 +1066,6 @@ }, "nteract": { "version": "nteract-front-end@1.0.0" - }, - "vscode": { - "interpreter": { - "hash": "8d732042e5e620df2ddb4aad7f460808ed1754fa045785bdb47941e58456b253" - } } }, "nbformat": 4,