{ "cells": [ { "cell_type": "code", "execution_count": 2, "id": "2b02a8cc-cea0-479c-8e76-f60339d1b63d", "metadata": {}, "outputs": [ { "data": { "application/mercury+json": "{\n \"widget\": \"File\",\n \"max_file_size\": \"100MB\",\n \"label\": \"File upload\",\n \"model_id\": \"ee137bf8a6124fe3b6085574164abb74\",\n \"code_uid\": \"File.0.50.74.4-rand4ea22662\",\n \"disabled\": false,\n \"hidden\": false\n}", "application/vnd.jupyter.widget-view+json": { "model_id": "ee137bf8a6124fe3b6085574164abb74", "version_major": 2, "version_minor": 0 }, "text/plain": [ "mercury.File" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import mercury as mr\n", " \n", "# add file upload widget\n", "my_file = mr.File(label=\"File upload\", max_file_size=\"100MB\")\n" ] }, { "cell_type": "code", "execution_count": 12, "id": "3ba380e2-9503-45aa-8419-456bea19bd98", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "\n", "#df = pd.read_csv(\"https://raw.githubusercontent.com/pandas-dev/pandas/refs/heads/main/pandas/tests/io/data/csv/iris.csv\")\n", "df = pd.read_csv(my_file.filepath)" ] }, { "cell_type": "code", "execution_count": 13, "id": "dd4cc720-da9e-4118-9a39-d13634b4d78f", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | SepalLength | \n", "SepalWidth | \n", "PetalLength | \n", "PetalWidth | \n", "Name | \n", "
---|---|---|---|---|---|
0 | \n", "5.1 | \n", "3.5 | \n", "1.4 | \n", "0.2 | \n", "Iris-setosa | \n", "
1 | \n", "4.9 | \n", "3.0 | \n", "1.4 | \n", "0.2 | \n", "Iris-setosa | \n", "
2 | \n", "4.7 | \n", "3.2 | \n", "1.3 | \n", "0.2 | \n", "Iris-setosa | \n", "
3 | \n", "4.6 | \n", "3.1 | \n", "1.5 | \n", "0.2 | \n", "Iris-setosa | \n", "
4 | \n", "5.0 | \n", "3.6 | \n", "1.4 | \n", "0.2 | \n", "Iris-setosa | \n", "
\n", " Create a plot in Python with matplotlib package.\n", "\n", "Input data:\n", "\n", "\n", "```python\n", "# pandas DataFrame\n", "'''\n", " SepalLength SepalWidth PetalLength PetalWidth Name\n", "0 5.1 3.5 1.4 0.2 Iris-setosa\n", "1 4.9 3.0 1.4 0.2 Iris-setosa\n", "2 4.7 3.2 1.3 0.2 Iris-setosa\n", "3 4.6 3.1 1.5 0.2 Iris-setosa\n", "4 5.0 3.6 1.4 0.2 Iris-setosa\n", "'''\n", "# DataFrame columns\n", "'''\n", "['SepalLength', 'SepalWidth', 'PetalLength', 'PetalWidth', 'Name']\n", "'''\n", "\n", "# pandas data frame variable is df\n", "```\n", " \n", "\n", "\n", "Plot should contain: make a pairwise plot\n", "\n", "Initial python code to be updated \n", "\n", "```python\n", "# TODO import required dependencies\n", "# TODO Provide the plot\n", "```\n", "\n", "Output only Python code.\n", "\n", "\n", "
\n", " ```python\n", "# import required dependencies\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "\n", "# Pairwise plot\n", "sns.pairplot(df, hue='Name')\n", "plt.show()\n", "```\n", "\n", "