From cb4eae7ed8f080495b5d8fd06b36098a17c9059c Mon Sep 17 00:00:00 2001 From: Arghadip Chakraborty Date: Tue, 9 Oct 2018 14:26:06 +0530 Subject: [PATCH 1/2] First 2 exercises done --- Assignment3.ipynb | 3279 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 3279 insertions(+) create mode 100644 Assignment3.ipynb diff --git a/Assignment3.ipynb b/Assignment3.ipynb new file mode 100644 index 0000000..9b179be --- /dev/null +++ b/Assignment3.ipynb @@ -0,0 +1,3279 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Basic Pandas.ipynb", + "version": "0.3.2", + "provenance": [], + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "[View in Colaboratory](https://colab.research.google.com/github/arghac14/Assignment-3/blob/arghac14/Assignment3.ipynb)" + ] + }, + { + "metadata": { + "id": "LnUddJZ59J3N", + "colab_type": "text" + }, + "cell_type": "markdown", + "source": [ + "# BASIC PANDAS" + ] + }, + { + "metadata": { + "id": "irlVYeeAXPDL", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "import pandas as pd\n", + "import numpy as np" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "BI2J-zdMbGwE", + "colab_type": "text" + }, + "cell_type": "markdown", + "source": [ + "### This is your playground feel free to explore other functions on pandas\n", + "\n", + "#### Create Series from numpy array, list and dict\n", + "\n", + "Don't know what a series is?\n", + "\n", + "[Series Doc](https://pandas.pydata.org/pandas-docs/version/0.22/generated/pandas.Series.html)" + ] + }, + { + "metadata": { + "id": "GeEct691YGE3", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 139 + }, + "outputId": "68facf9b-92f2-46f5-ef72-cc244d3e3727" + }, + "cell_type": "code", + "source": [ + "a_ascii = ord('A')\n", + "z_ascii = ord('Z')\n", + "alphabets = [chr(i) for i in range(a_ascii, z_ascii+1)]\n", + "print(alphabets)\n", + "\n", + "numbers = np.arange(26)\n", + "\n", + "print(numbers)\n", + "\n", + "print(type(alphabets), type(numbers))\n", + "\n", + "alpha_numbers = dict(zip(alphabets, numbers))\n", + "\n", + "print(alpha_numbers)\n", + "\n", + "print(type(alpha_numbers))" + ], + "execution_count": 23, + "outputs": [ + { + "output_type": "stream", + "text": [ + "['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']\n", + "[ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23\n", + " 24 25]\n", + " \n", + "{'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7, 'I': 8, 'J': 9, 'K': 10, 'L': 11, 'M': 12, 'N': 13, 'O': 14, 'P': 15, 'Q': 16, 'R': 17, 'S': 18, 'T': 19, 'U': 20, 'V': 21, 'W': 22, 'X': 23, 'Y': 24, 'Z': 25}\n", + "\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "6ouDfjWab_Mc", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 476 + }, + "outputId": "c3baed92-3162-4d28-b60d-60be4df58ff7" + }, + "cell_type": "code", + "source": [ + "series1 = pd.Series(alphabets)\n", + "print(series1)" + ], + "execution_count": 8, + "outputs": [ + { + "output_type": "stream", + "text": [ + "0 A\n", + "1 B\n", + "2 C\n", + "3 D\n", + "4 E\n", + "5 F\n", + "6 G\n", + "7 H\n", + "8 I\n", + "9 J\n", + "10 K\n", + "11 L\n", + "12 M\n", + "13 N\n", + "14 O\n", + "15 P\n", + "16 Q\n", + "17 R\n", + "18 S\n", + "19 T\n", + "20 U\n", + "21 V\n", + "22 W\n", + "23 X\n", + "24 Y\n", + "25 Z\n", + "dtype: object\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "At7nY7vVcBZ3", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 476 + }, + "outputId": "33560d3a-e848-4b58-ac2f-d0a2899314eb" + }, + "cell_type": "code", + "source": [ + "series2 = pd.Series(numbers)\n", + "print(series2)" + ], + "execution_count": 9, + "outputs": [ + { + "output_type": "stream", + "text": [ + "0 0\n", + "1 1\n", + "2 2\n", + "3 3\n", + "4 4\n", + "5 5\n", + "6 6\n", + "7 7\n", + "8 8\n", + "9 9\n", + "10 10\n", + "11 11\n", + "12 12\n", + "13 13\n", + "14 14\n", + "15 15\n", + "16 16\n", + "17 17\n", + "18 18\n", + "19 19\n", + "20 20\n", + "21 21\n", + "22 22\n", + "23 23\n", + "24 24\n", + "25 25\n", + "dtype: int64\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "J5z-2CWAdH6N", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 476 + }, + "outputId": "edb6a388-4ca2-4c97-a2d5-590a9cecf927" + }, + "cell_type": "code", + "source": [ + "series3 = pd.Series(alpha_numbers)\n", + "print(series3)" + ], + "execution_count": 10, + "outputs": [ + { + "output_type": "stream", + "text": [ + "A 0\n", + "B 1\n", + "C 2\n", + "D 3\n", + "E 4\n", + "F 5\n", + "G 6\n", + "H 7\n", + "I 8\n", + "J 9\n", + "K 10\n", + "L 11\n", + "M 12\n", + "N 13\n", + "O 14\n", + "P 15\n", + "Q 16\n", + "R 17\n", + "S 18\n", + "T 19\n", + "U 20\n", + "V 21\n", + "W 22\n", + "X 23\n", + "Y 24\n", + "Z 25\n", + "dtype: int64\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "fYzblGGudKjO", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 170 + }, + "outputId": "b272a885-7d3e-4ffb-fc3d-3827598cb47b" + }, + "cell_type": "code", + "source": [ + "#replace head() with head(n) where n can be any number between [0-25] and observe the output in deach case \n", + "series3.head(8)" + ], + "execution_count": 11, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "A 0\n", + "B 1\n", + "C 2\n", + "D 3\n", + "E 4\n", + "F 5\n", + "G 6\n", + "H 7\n", + "dtype: int64" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 11 + } + ] + }, + { + "metadata": { + "id": "OwsJIf5feTtg", + "colab_type": "text" + }, + "cell_type": "markdown", + "source": [ + "#### Create DataFrame from lists\n", + "\n", + "[DataFrame Doc](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html)" + ] + }, + { + "metadata": { + "id": "73UTZ07EdWki", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 855 + }, + "outputId": "0a7db5ff-77d3-4a84-8b82-570bacdf9df5" + }, + "cell_type": "code", + "source": [ + "data = {'alphabets': alphabets, 'values': numbers}\n", + "\n", + "df = pd.DataFrame(data)\n", + "\n", + "#Lets Change the column `values` to `alpha_numbers`\n", + "\n", + "df.columns = ['alphabets', 'alpha_numbers']\n", + "\n", + "df" + ], + "execution_count": 26, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
alphabetsalpha_numbers
0A0
1B1
2C2
3D3
4E4
5F5
6G6
7H7
8I8
9J9
10K10
11L11
12M12
13N13
14O14
15P15
16Q16
17R17
18S18
19T19
20U20
21V21
22W22
23X23
24Y24
25Z25
\n", + "
" + ], + "text/plain": [ + " alphabets alpha_numbers\n", + "0 A 0\n", + "1 B 1\n", + "2 C 2\n", + "3 D 3\n", + "4 E 4\n", + "5 F 5\n", + "6 G 6\n", + "7 H 7\n", + "8 I 8\n", + "9 J 9\n", + "10 K 10\n", + "11 L 11\n", + "12 M 12\n", + "13 N 13\n", + "14 O 14\n", + "15 P 15\n", + "16 Q 16\n", + "17 R 17\n", + "18 S 18\n", + "19 T 19\n", + "20 U 20\n", + "21 V 21\n", + "22 W 22\n", + "23 X 23\n", + "24 Y 24\n", + "25 Z 25" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 26 + } + ] + }, + { + "metadata": { + "id": "uaK_1EO9etGS", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 140 + }, + "outputId": "6a431741-9b3b-4870-e338-0f505c585482" + }, + "cell_type": "code", + "source": [ + "# transpose\n", + "\n", + "df.T\n", + "\n", + "# there are many more operations which we can perform look at the documentation with the subsequent exercises we will learn more" + ], + "execution_count": 14, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
0123456789...16171819202122232425
alphabets0123456789...16171819202122232425
alpha_numbersABCDEFGHIJ...QRSTUVWXYZ
\n", + "

2 rows × 26 columns

\n", + "
" + ], + "text/plain": [ + " 0 1 2 3 4 5 6 7 8 9 ... 16 17 18 19 20 21 22 \\\n", + "alphabets 0 1 2 3 4 5 6 7 8 9 ... 16 17 18 19 20 21 22 \n", + "alpha_numbers A B C D E F G H I J ... Q R S T U V W \n", + "\n", + " 23 24 25 \n", + "alphabets 23 24 25 \n", + "alpha_numbers X Y Z \n", + "\n", + "[2 rows x 26 columns]" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 14 + } + ] + }, + { + "metadata": { + "id": "ZYonoaW8gEAJ", + "colab_type": "text" + }, + "cell_type": "markdown", + "source": [ + "#### Extract Items from a series" + ] + }, + { + "metadata": { + "id": "tc1-KX_Bfe7U", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 663 + }, + "outputId": "f6773c99-d093-4782-c6c5-6ab542551dc1" + }, + "cell_type": "code", + "source": [ + "ser = pd.Series(list('abcdefghijklmnopqrstuvwxyz'))\n", + "\n", + "pos = [0, 4, 8, 14, 20]\n", + "\n", + "vowels = ser.take(pos)\n", + "\n", + "df = pd.DataFrame(vowels)#, columns=['vowels'])\n", + "\n", + "df.columns = ['vowels']\n", + "df.index = [0, 1, 2, 3, 4]\n", + "\n", + "df" + ], + "execution_count": 28, + "outputs": [ + { + "output_type": "stream", + "text": [ + "0 a\n", + "1 b\n", + "2 c\n", + "3 d\n", + "4 e\n", + "5 f\n", + "6 g\n", + "7 h\n", + "8 i\n", + "9 j\n", + "10 k\n", + "11 l\n", + "12 m\n", + "13 n\n", + "14 o\n", + "15 p\n", + "16 q\n", + "17 r\n", + "18 s\n", + "19 t\n", + "20 u\n", + "21 v\n", + "22 w\n", + "23 x\n", + "24 y\n", + "25 z\n", + "dtype: object\n" + ], + "name": "stdout" + }, + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
vowels
0a
1e
2i
3o
4u
\n", + "
" + ], + "text/plain": [ + " vowels\n", + "0 a\n", + "1 e\n", + "2 i\n", + "3 o\n", + "4 u" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 28 + } + ] + }, + { + "metadata": { + "id": "cmDxwtDNjWpO", + "colab_type": "text" + }, + "cell_type": "markdown", + "source": [ + "#### Change the first character of each word to upper case in each word of ser" + ] + }, + { + "metadata": { + "id": "5KagP9PpgV2F", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "e64c7bc8-5885-46a6-fbb5-ec980e1fd35e" + }, + "cell_type": "code", + "source": [ + "ser = pd.Series(['we', 'are', 'learning', 'pandas'])\n", + "\n", + "ser.map(lambda x : x.title())\n", + "\n", + "titles = [i.title() for i in ser]\n", + "\n", + "titles" + ], + "execution_count": 17, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['We', 'Are', 'Learning', 'Pandas']" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 17 + } + ] + }, + { + "metadata": { + "id": "qn47ee-MkZN8", + "colab_type": "text" + }, + "cell_type": "markdown", + "source": [ + "#### Reindexing" + ] + }, + { + "metadata": { + "id": "h5R0JL2NjuFS", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 204 + }, + "outputId": "2bda5da8-bf7c-453c-d98f-d0c8656e5090" + }, + "cell_type": "code", + "source": [ + "my_index = [1, 2, 3, 4, 5]\n", + "\n", + "df1 = pd.DataFrame({'upper values': ['A', 'B', 'C', 'D', 'E'],\n", + " 'lower values': ['a', 'b', 'c', 'd', 'e']},\n", + " index = my_index)\n", + "\n", + "df1" + ], + "execution_count": 18, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
lower valuesupper values
1aA
2bB
3cC
4dD
5eE
\n", + "
" + ], + "text/plain": [ + " lower values upper values\n", + "1 a A\n", + "2 b B\n", + "3 c C\n", + "4 d D\n", + "5 e E" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 18 + } + ] + }, + { + "metadata": { + "id": "G_Frvc3mk93k", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 204 + }, + "outputId": "ffb3e84f-7628-4dad-f9b8-beb9993ab59b" + }, + "cell_type": "code", + "source": [ + "new_index = [2, 5, 4, 3, 1]\n", + "\n", + "df1.reindex(index = new_index)" + ], + "execution_count": 19, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
lower valuesupper values
2bB
5eE
4dD
3cC
1aA
\n", + "
" + ], + "text/plain": [ + " lower values upper values\n", + "2 b B\n", + "5 e E\n", + "4 d D\n", + "3 c C\n", + "1 a A" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 19 + } + ] + }, + { + "metadata": { + "id": "kbGHHDj-_lRK", + "colab_type": "text" + }, + "cell_type": "markdown", + "source": [ + "# Get to know your Data\n" + ] + }, + { + "metadata": { + "id": "e-L2d8nW_xhK", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "import pandas as pd\n", + "import numpy as np\n", + "iris_df = pd.read_csv('https://raw.githubusercontent.com/uiuc-cse/data-fa14/gh-pages/data/iris.csv')\n" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "0noS2eJu_-CK", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 359 + }, + "outputId": "cb7b65ff-ae80-4320-d6c6-781798ba81e7" + }, + "cell_type": "code", + "source": [ + "iris_df.head(10)" + ], + "execution_count": 30, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
05.13.51.40.2setosa
14.93.01.40.2setosa
24.73.21.30.2setosa
34.63.11.50.2setosa
45.03.61.40.2setosa
55.43.91.70.4setosa
64.63.41.40.3setosa
75.03.41.50.2setosa
84.42.91.40.2setosa
94.93.11.50.1setosa
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width species\n", + "0 5.1 3.5 1.4 0.2 setosa\n", + "1 4.9 3.0 1.4 0.2 setosa\n", + "2 4.7 3.2 1.3 0.2 setosa\n", + "3 4.6 3.1 1.5 0.2 setosa\n", + "4 5.0 3.6 1.4 0.2 setosa\n", + "5 5.4 3.9 1.7 0.4 setosa\n", + "6 4.6 3.4 1.4 0.3 setosa\n", + "7 5.0 3.4 1.5 0.2 setosa\n", + "8 4.4 2.9 1.4 0.2 setosa\n", + "9 4.9 3.1 1.5 0.1 setosa" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 30 + } + ] + }, + { + "metadata": { + "id": "AHS6dOGFABCM", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 68 + }, + "outputId": "d40b3c25-ae61-421e-da2b-ab135cd455cf" + }, + "cell_type": "code", + "source": [ + "print(iris_df.shape)\n", + "print(iris_df.shape[0])\n", + "print(iris_df.shape[1])" + ], + "execution_count": 32, + "outputs": [ + { + "output_type": "stream", + "text": [ + "(150, 5)\n", + "150\n", + "5\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "svTI74N7AJC9", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 68 + }, + "outputId": "c632fc8f-e4a7-4ae0-c3dc-7cf84b4ab909" + }, + "cell_type": "code", + "source": [ + "print(iris_df.columns)\n" + ], + "execution_count": 33, + "outputs": [ + { + "output_type": "stream", + "text": [ + "Index(['sepal_length', 'sepal_width', 'petal_length', 'petal_width',\n", + " 'species'],\n", + " dtype='object')\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "Bxc8i6avrZPw", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 221 + }, + "outputId": "c6ed98ba-bebb-4ba3-a631-9aaab5d81924" + }, + "cell_type": "code", + "source": [ + "\n", + "print(iris_df.head())\n", + "\n", + "new_index = np.random.permutation(iris_df.index)\n", + "iris_df = iris_df.reindex(index = new_index)\n", + "\n", + "print(iris_df.head())" + ], + "execution_count": 34, + "outputs": [ + { + "output_type": "stream", + "text": [ + " sepal_length sepal_width petal_length petal_width species\n", + "0 5.1 3.5 1.4 0.2 setosa\n", + "1 4.9 3.0 1.4 0.2 setosa\n", + "2 4.7 3.2 1.3 0.2 setosa\n", + "3 4.6 3.1 1.5 0.2 setosa\n", + "4 5.0 3.6 1.4 0.2 setosa\n", + " sepal_length sepal_width petal_length petal_width species\n", + "143 6.8 3.2 5.9 2.3 virginica\n", + "6 4.6 3.4 1.4 0.3 setosa\n", + "81 5.5 2.4 3.7 1.0 versicolor\n", + "27 5.2 3.5 1.5 0.2 setosa\n", + "42 4.4 3.2 1.3 0.2 setosa\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "seYXHXsYsYJI", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 323 + }, + "outputId": "3af4524f-2bbf-4b42-9907-3115e795ac81" + }, + "cell_type": "code", + "source": [ + "#original\n", + "\n", + "print(iris_df.head())\n", + "\n", + "iris_df['sepal_width'] *= 10\n", + "\n", + "#changed\n", + "\n", + "print(iris_df.head())\n", + "\n", + "#lets undo the operation\n", + "\n", + "iris_df['sepal_width'] /= 10\n", + "\n", + "print(iris_df.head())" + ], + "execution_count": 35, + "outputs": [ + { + "output_type": "stream", + "text": [ + " sepal_length sepal_width petal_length petal_width species\n", + "143 6.8 3.2 5.9 2.3 virginica\n", + "6 4.6 3.4 1.4 0.3 setosa\n", + "81 5.5 2.4 3.7 1.0 versicolor\n", + "27 5.2 3.5 1.5 0.2 setosa\n", + "42 4.4 3.2 1.3 0.2 setosa\n", + " sepal_length sepal_width petal_length petal_width species\n", + "143 6.8 32.0 5.9 2.3 virginica\n", + "6 4.6 34.0 1.4 0.3 setosa\n", + "81 5.5 24.0 3.7 1.0 versicolor\n", + "27 5.2 35.0 1.5 0.2 setosa\n", + "42 4.4 32.0 1.3 0.2 setosa\n", + " sepal_length sepal_width petal_length petal_width species\n", + "143 6.8 3.2 5.9 2.3 virginica\n", + "6 4.6 3.4 1.4 0.3 setosa\n", + "81 5.5 2.4 3.7 1.0 versicolor\n", + "27 5.2 3.5 1.5 0.2 setosa\n", + "42 4.4 3.2 1.3 0.2 setosa\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "WJ7W-F-d0AoZ", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 1165 + }, + "outputId": "f8ba0624-fda2-4742-f8b9-1c0ba147d373" + }, + "cell_type": "code", + "source": [ + "iris_df[iris_df['sepal_width']>3.3]" + ], + "execution_count": 36, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
64.63.41.40.3setosa
275.23.51.50.2setosa
335.54.21.40.2setosa
195.13.81.50.3setosa
55.43.91.70.4setosa
285.23.41.40.2setosa
224.63.61.00.2setosa
1317.93.86.42.0virginica
185.73.81.70.3setosa
856.03.44.51.6versicolor
215.13.71.50.4setosa
75.03.41.50.2setosa
175.13.51.40.3setosa
165.43.91.30.4setosa
365.53.51.30.2setosa
155.74.41.50.4setosa
395.13.41.50.2setosa
05.13.51.40.2setosa
45.03.61.40.2setosa
325.24.11.50.1setosa
244.83.41.90.2setosa
265.03.41.60.4setosa
1366.33.45.62.4virginica
405.03.51.30.3setosa
465.13.81.60.2setosa
315.43.41.50.4setosa
435.03.51.60.6setosa
114.83.41.60.2setosa
445.13.81.90.4setosa
1177.73.86.72.2virginica
105.43.71.50.2setosa
145.84.01.20.2setosa
485.33.71.50.2setosa
205.43.41.70.2setosa
1486.23.45.42.3virginica
1097.23.66.12.5virginica
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width species\n", + "6 4.6 3.4 1.4 0.3 setosa\n", + "27 5.2 3.5 1.5 0.2 setosa\n", + "33 5.5 4.2 1.4 0.2 setosa\n", + "19 5.1 3.8 1.5 0.3 setosa\n", + "5 5.4 3.9 1.7 0.4 setosa\n", + "28 5.2 3.4 1.4 0.2 setosa\n", + "22 4.6 3.6 1.0 0.2 setosa\n", + "131 7.9 3.8 6.4 2.0 virginica\n", + "18 5.7 3.8 1.7 0.3 setosa\n", + "85 6.0 3.4 4.5 1.6 versicolor\n", + "21 5.1 3.7 1.5 0.4 setosa\n", + "7 5.0 3.4 1.5 0.2 setosa\n", + "17 5.1 3.5 1.4 0.3 setosa\n", + "16 5.4 3.9 1.3 0.4 setosa\n", + "36 5.5 3.5 1.3 0.2 setosa\n", + "15 5.7 4.4 1.5 0.4 setosa\n", + "39 5.1 3.4 1.5 0.2 setosa\n", + "0 5.1 3.5 1.4 0.2 setosa\n", + "4 5.0 3.6 1.4 0.2 setosa\n", + "32 5.2 4.1 1.5 0.1 setosa\n", + "24 4.8 3.4 1.9 0.2 setosa\n", + "26 5.0 3.4 1.6 0.4 setosa\n", + "136 6.3 3.4 5.6 2.4 virginica\n", + "40 5.0 3.5 1.3 0.3 setosa\n", + "46 5.1 3.8 1.6 0.2 setosa\n", + "31 5.4 3.4 1.5 0.4 setosa\n", + "43 5.0 3.5 1.6 0.6 setosa\n", + "11 4.8 3.4 1.6 0.2 setosa\n", + "44 5.1 3.8 1.9 0.4 setosa\n", + "117 7.7 3.8 6.7 2.2 virginica\n", + "10 5.4 3.7 1.5 0.2 setosa\n", + "14 5.8 4.0 1.2 0.2 setosa\n", + "48 5.3 3.7 1.5 0.2 setosa\n", + "20 5.4 3.4 1.7 0.2 setosa\n", + "148 6.2 3.4 5.4 2.3 virginica\n", + "109 7.2 3.6 6.1 2.5 virginica" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 36 + } + ] + }, + { + "metadata": { + "id": "4U7ksr_R2H7M", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 80 + }, + "outputId": "81f4773f-80b7-4f47-ee31-761f0c0f38ea" + }, + "cell_type": "code", + "source": [ + "iris_df[(iris_df['sepal_width']>3.3) & (iris_df['species'] == 'versicolor')] " + ], + "execution_count": 37, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
856.03.44.51.6versicolor
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width species\n", + "85 6.0 3.4 4.5 1.6 versicolor" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 37 + } + ] + }, + { + "metadata": { + "id": "ntegaw7oA2_Y", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "M6EN78ufoJY7", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "a872e669-acf0-4e67-ab10-9b55612889e6" + }, + "cell_type": "code", + "source": [ + "species = iris_df['species'].unique()\n", + "\n", + "print(species)" + ], + "execution_count": 38, + "outputs": [ + { + "output_type": "stream", + "text": [ + "['virginica' 'setosa' 'versicolor']\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "gZvpbKBwoVUe", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 204 + }, + "outputId": "5a81e11e-9e8f-481d-8c6d-58a2915a6966" + }, + "cell_type": "code", + "source": [ + "setosa = iris_df[iris_df['species'] == species[0]]\n", + "\n", + "setosa.head()" + ], + "execution_count": 39, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
1436.83.25.92.3virginica
1276.13.04.91.8virginica
1257.23.26.01.8virginica
1135.72.55.02.0virginica
1446.73.35.72.5virginica
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width species\n", + "143 6.8 3.2 5.9 2.3 virginica\n", + "127 6.1 3.0 4.9 1.8 virginica\n", + "125 7.2 3.2 6.0 1.8 virginica\n", + "113 5.7 2.5 5.0 2.0 virginica\n", + "144 6.7 3.3 5.7 2.5 virginica" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 39 + } + ] + }, + { + "metadata": { + "id": "7tumfZ3DotPG", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 204 + }, + "outputId": "534b33f7-1f4a-43ad-d4ac-316a59e0b22a" + }, + "cell_type": "code", + "source": [ + " \n", + "versicolor = iris_df[iris_df['species'] == species[1]]\n", + "\n", + "versicolor.head()" + ], + "execution_count": 44, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
64.63.41.40.3setosa
275.23.51.50.2setosa
424.43.21.30.2setosa
335.54.21.40.2setosa
195.13.81.50.3setosa
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width species\n", + "6 4.6 3.4 1.4 0.3 setosa\n", + "27 5.2 3.5 1.5 0.2 setosa\n", + "42 4.4 3.2 1.3 0.2 setosa\n", + "33 5.5 4.2 1.4 0.2 setosa\n", + "19 5.1 3.8 1.5 0.3 setosa" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 44 + } + ] + }, + { + "metadata": { + "id": "JI75_hQcBgoz", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "cUYm5UqVpDPy", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 204 + }, + "outputId": "356926ed-ad6b-4eec-88c9-5cf22f2cb3ed" + }, + "cell_type": "code", + "source": [ + "\n", + "\n", + "virginica = iris_df[iris_df['species'] == species[2]]\n", + "\n", + "virginica.head()" + ], + "execution_count": 41, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
815.52.43.71.0versicolor
766.82.84.81.4versicolor
546.52.84.61.5versicolor
925.82.64.01.2versicolor
825.82.73.91.2versicolor
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width species\n", + "81 5.5 2.4 3.7 1.0 versicolor\n", + "76 6.8 2.8 4.8 1.4 versicolor\n", + "54 6.5 2.8 4.6 1.5 versicolor\n", + "92 5.8 2.6 4.0 1.2 versicolor\n", + "82 5.8 2.7 3.9 1.2 versicolor" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 41 + } + ] + }, + { + "metadata": { + "id": "K7KIj6fv2zWP", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 1969 + }, + "outputId": "c758c995-f849-4942-e01c-335be5305594" + }, + "cell_type": "code", + "source": [ + "iris_df.sort_values(by='sepal_width')" + ], + "execution_count": 43, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
605.02.03.51.0versicolor
626.02.24.01.0versicolor
686.22.24.51.5versicolor
1196.02.25.01.5virginica
935.02.33.31.0versicolor
535.52.34.01.3versicolor
414.52.31.30.3setosa
876.32.34.41.3versicolor
815.52.43.71.0versicolor
805.52.43.81.1versicolor
574.92.43.31.0versicolor
1135.72.55.02.0virginica
895.52.54.01.3versicolor
1064.92.54.51.7virginica
1086.72.55.81.8virginica
695.62.53.91.1versicolor
1466.32.55.01.9virginica
726.32.54.91.5versicolor
985.12.53.01.1versicolor
905.52.64.41.2versicolor
795.72.63.51.0versicolor
1346.12.65.61.4virginica
925.82.64.01.2versicolor
1187.72.66.92.3virginica
1236.32.74.91.8virginica
836.02.75.11.6versicolor
825.82.73.91.2versicolor
1425.82.75.11.9virginica
595.22.73.91.4versicolor
1015.82.75.11.9virginica
..................
856.03.44.51.6versicolor
205.43.41.70.2setosa
1486.23.45.42.3virginica
285.23.41.40.2setosa
75.03.41.50.2setosa
315.43.41.50.4setosa
275.23.51.50.2setosa
405.03.51.30.3setosa
435.03.51.60.6setosa
05.13.51.40.2setosa
175.13.51.40.3setosa
365.53.51.30.2setosa
224.63.61.00.2setosa
1097.23.66.12.5virginica
45.03.61.40.2setosa
215.13.71.50.4setosa
485.33.71.50.2setosa
105.43.71.50.2setosa
1317.93.86.42.0virginica
185.73.81.70.3setosa
195.13.81.50.3setosa
1177.73.86.72.2virginica
445.13.81.90.4setosa
465.13.81.60.2setosa
165.43.91.30.4setosa
55.43.91.70.4setosa
145.84.01.20.2setosa
325.24.11.50.1setosa
335.54.21.40.2setosa
155.74.41.50.4setosa
\n", + "

150 rows × 5 columns

\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width species\n", + "60 5.0 2.0 3.5 1.0 versicolor\n", + "62 6.0 2.2 4.0 1.0 versicolor\n", + "68 6.2 2.2 4.5 1.5 versicolor\n", + "119 6.0 2.2 5.0 1.5 virginica\n", + "93 5.0 2.3 3.3 1.0 versicolor\n", + "53 5.5 2.3 4.0 1.3 versicolor\n", + "41 4.5 2.3 1.3 0.3 setosa\n", + "87 6.3 2.3 4.4 1.3 versicolor\n", + "81 5.5 2.4 3.7 1.0 versicolor\n", + "80 5.5 2.4 3.8 1.1 versicolor\n", + "57 4.9 2.4 3.3 1.0 versicolor\n", + "113 5.7 2.5 5.0 2.0 virginica\n", + "89 5.5 2.5 4.0 1.3 versicolor\n", + "106 4.9 2.5 4.5 1.7 virginica\n", + "108 6.7 2.5 5.8 1.8 virginica\n", + "69 5.6 2.5 3.9 1.1 versicolor\n", + "146 6.3 2.5 5.0 1.9 virginica\n", + "72 6.3 2.5 4.9 1.5 versicolor\n", + "98 5.1 2.5 3.0 1.1 versicolor\n", + "90 5.5 2.6 4.4 1.2 versicolor\n", + "79 5.7 2.6 3.5 1.0 versicolor\n", + "134 6.1 2.6 5.6 1.4 virginica\n", + "92 5.8 2.6 4.0 1.2 versicolor\n", + "118 7.7 2.6 6.9 2.3 virginica\n", + "123 6.3 2.7 4.9 1.8 virginica\n", + "83 6.0 2.7 5.1 1.6 versicolor\n", + "82 5.8 2.7 3.9 1.2 versicolor\n", + "142 5.8 2.7 5.1 1.9 virginica\n", + "59 5.2 2.7 3.9 1.4 versicolor\n", + "101 5.8 2.7 5.1 1.9 virginica\n", + ".. ... ... ... ... ...\n", + "85 6.0 3.4 4.5 1.6 versicolor\n", + "20 5.4 3.4 1.7 0.2 setosa\n", + "148 6.2 3.4 5.4 2.3 virginica\n", + "28 5.2 3.4 1.4 0.2 setosa\n", + "7 5.0 3.4 1.5 0.2 setosa\n", + "31 5.4 3.4 1.5 0.4 setosa\n", + "27 5.2 3.5 1.5 0.2 setosa\n", + "40 5.0 3.5 1.3 0.3 setosa\n", + "43 5.0 3.5 1.6 0.6 setosa\n", + "0 5.1 3.5 1.4 0.2 setosa\n", + "17 5.1 3.5 1.4 0.3 setosa\n", + "36 5.5 3.5 1.3 0.2 setosa\n", + "22 4.6 3.6 1.0 0.2 setosa\n", + "109 7.2 3.6 6.1 2.5 virginica\n", + "4 5.0 3.6 1.4 0.2 setosa\n", + "21 5.1 3.7 1.5 0.4 setosa\n", + "48 5.3 3.7 1.5 0.2 setosa\n", + "10 5.4 3.7 1.5 0.2 setosa\n", + "131 7.9 3.8 6.4 2.0 virginica\n", + "18 5.7 3.8 1.7 0.3 setosa\n", + "19 5.1 3.8 1.5 0.3 setosa\n", + "117 7.7 3.8 6.7 2.2 virginica\n", + "44 5.1 3.8 1.9 0.4 setosa\n", + "46 5.1 3.8 1.6 0.2 setosa\n", + "16 5.4 3.9 1.3 0.4 setosa\n", + "5 5.4 3.9 1.7 0.4 setosa\n", + "14 5.8 4.0 1.2 0.2 setosa\n", + "32 5.2 4.1 1.5 0.1 setosa\n", + "33 5.5 4.2 1.4 0.2 setosa\n", + "15 5.7 4.4 1.5 0.4 setosa\n", + "\n", + "[150 rows x 5 columns]" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 43 + } + ] + }, + { + "metadata": { + "id": "Xh-qeZYsB0s4", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "eHrn3ZVRpOk5", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 297 + }, + "outputId": "d092f3ee-4850-4ab1-e15e-95b3ca3c789d" + }, + "cell_type": "code", + "source": [ + "setosa.describe()" + ], + "execution_count": 47, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_width
count50.0000050.00000050.00000050.00000
mean6.588002.9740005.5520002.02600
std0.635880.3224970.5518950.27465
min4.900002.2000004.5000001.40000
25%6.225002.8000005.1000001.80000
50%6.500003.0000005.5500002.00000
75%6.900003.1750005.8750002.30000
max7.900003.8000006.9000002.50000
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width\n", + "count 50.00000 50.000000 50.000000 50.00000\n", + "mean 6.58800 2.974000 5.552000 2.02600\n", + "std 0.63588 0.322497 0.551895 0.27465\n", + "min 4.90000 2.200000 4.500000 1.40000\n", + "25% 6.22500 2.800000 5.100000 1.80000\n", + "50% 6.50000 3.000000 5.550000 2.00000\n", + "75% 6.90000 3.175000 5.875000 2.30000\n", + "max 7.90000 3.800000 6.900000 2.50000" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 47 + } + ] + }, + { + "metadata": { + "id": "GwJFT2GlpwUv", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 297 + }, + "outputId": "2eabe02c-93a5-4a84-ce12-fc477c2fb1f8" + }, + "cell_type": "code", + "source": [ + "versicolor.describe()" + ], + "execution_count": 48, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_width
count50.0000050.00000050.00000050.00000
mean5.006003.4180001.4640000.24400
std0.352490.3810240.1735110.10721
min4.300002.3000001.0000000.10000
25%4.800003.1250001.4000000.20000
50%5.000003.4000001.5000000.20000
75%5.200003.6750001.5750000.30000
max5.800004.4000001.9000000.60000
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width\n", + "count 50.00000 50.000000 50.000000 50.00000\n", + "mean 5.00600 3.418000 1.464000 0.24400\n", + "std 0.35249 0.381024 0.173511 0.10721\n", + "min 4.30000 2.300000 1.000000 0.10000\n", + "25% 4.80000 3.125000 1.400000 0.20000\n", + "50% 5.00000 3.400000 1.500000 0.20000\n", + "75% 5.20000 3.675000 1.575000 0.30000\n", + "max 5.80000 4.400000 1.900000 0.60000" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 48 + } + ] + }, + { + "metadata": { + "id": "Ad4qhSZLpztf", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 297 + }, + "outputId": "fe5aee87-e1ce-4930-fb14-ecb6099e54ef" + }, + "cell_type": "code", + "source": [ + "virginica.describe()" + ], + "execution_count": 49, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_width
count50.00000050.00000050.00000050.000000
mean5.9360002.7700004.2600001.326000
std0.5161710.3137980.4699110.197753
min4.9000002.0000003.0000001.000000
25%5.6000002.5250004.0000001.200000
50%5.9000002.8000004.3500001.300000
75%6.3000003.0000004.6000001.500000
max7.0000003.4000005.1000001.800000
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width\n", + "count 50.000000 50.000000 50.000000 50.000000\n", + "mean 5.936000 2.770000 4.260000 1.326000\n", + "std 0.516171 0.313798 0.469911 0.197753\n", + "min 4.900000 2.000000 3.000000 1.000000\n", + "25% 5.600000 2.525000 4.000000 1.200000\n", + "50% 5.900000 2.800000 4.350000 1.300000\n", + "75% 6.300000 3.000000 4.600000 1.500000\n", + "max 7.000000 3.400000 5.100000 1.800000" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 49 + } + ] + }, + { + "metadata": { + "id": "rqDXuuAtt7C3", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 398 + }, + "outputId": "a2a7a6c1-e31e-499e-a64c-4b67441764e9" + }, + "cell_type": "code", + "source": [ + "import matplotlib.pyplot as plt\n", + "\n", + "#hist creates a histogram there are many more plots(see the documentation) you can play with it.\n", + "\n", + "plt.hist(setosa['sepal_length'])\n", + "plt.hist(versicolor['sepal_length'])\n", + "plt.hist(virginica['sepal_length'])" + ], + "execution_count": 50, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(array([ 4., 1., 6., 10., 5., 8., 5., 3., 5., 3.]),\n", + " array([4.9 , 5.11, 5.32, 5.53, 5.74, 5.95, 6.16, 6.37, 6.58, 6.79, 7. ]),\n", + " )" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 50 + }, + { + "output_type": "display_data", + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAd8AAAFKCAYAAABcq1WoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAFHRJREFUeJzt3Xts1Xf9+PFX6ZGRljo7bGHowGVq\nFrfhIJsZDHBDLm64GzoKhOHy3S8R6QATDCDB0ITEjIXvgrq56YbML4SEjSFUY2SRQWI2QCMGxWRh\nYGK4bFBGoVzDZef3h6ERBy2cnr4P5/Tx+IvzOaef83rzJufZcw49Lctms9kAAJLpVugBAKCrEV8A\nSEx8ASAx8QWAxMQXABITXwBILJPiTpqajqW4m7yorq6I5uaThR6jU5X6Gq2v+JX6Gq2v+F3JGmtq\nqi57nWe+/yWTKS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vZ/djxoyJ8ePHR0TE/PnzY+3atSWzh+2t\nrxT2MOLj78//4he/iLvvvjsGDhwYs2bNiqeeeirKysqivr4+qqry/xvgOltb6+vTp09861vfim7d\nusWIESNiwIABBZz06tXV1cW8efNi8uTJce7cuWhoaMjb/vl4SQBIrMu+7AwAhSK+AJCY+AJAYuIL\nAImJLwAkJr4AkJj4AkBi4gsAif1/UFKJ1QILF/YAAAAASUVORK5CYII=\n", + "text/plain": [ + "" + ] + }, + "metadata": { + "tags": [] + } + } + ] + }, + { + "metadata": { + "id": "73HXgh3eCK2E", + "colab_type": "text" + }, + "cell_type": "markdown", + "source": [ + "# PANDAS EXERCISE" + ] + } + ] +} \ No newline at end of file From fa990ded119245293c6c8ab6084cfa86b27776c7 Mon Sep 17 00:00:00 2001 From: Arghadip Chakraborty Date: Tue, 9 Oct 2018 15:15:20 +0530 Subject: [PATCH 2/2] Completed all 3 Notebooks --- Assignment-3.ipynb | 3998 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 3998 insertions(+) create mode 100644 Assignment-3.ipynb diff --git a/Assignment-3.ipynb b/Assignment-3.ipynb new file mode 100644 index 0000000..d3ae168 --- /dev/null +++ b/Assignment-3.ipynb @@ -0,0 +1,3998 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Basic Pandas.ipynb", + "version": "0.3.2", + "provenance": [], + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "[View in Colaboratory](https://colab.research.google.com/github/arghac14/Assignment-3/blob/arghac14/Assignment-3.ipynb)" + ] + }, + { + "metadata": { + "id": "LnUddJZ59J3N", + "colab_type": "text" + }, + "cell_type": "markdown", + "source": [ + "# BASIC PANDAS" + ] + }, + { + "metadata": { + "id": "irlVYeeAXPDL", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "import pandas as pd\n", + "import numpy as np" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "BI2J-zdMbGwE", + "colab_type": "text" + }, + "cell_type": "markdown", + "source": [ + "### This is your playground feel free to explore other functions on pandas\n", + "\n", + "#### Create Series from numpy array, list and dict\n", + "\n", + "Don't know what a series is?\n", + "\n", + "[Series Doc](https://pandas.pydata.org/pandas-docs/version/0.22/generated/pandas.Series.html)" + ] + }, + { + "metadata": { + "id": "GeEct691YGE3", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 139 + }, + "outputId": "68facf9b-92f2-46f5-ef72-cc244d3e3727" + }, + "cell_type": "code", + "source": [ + "a_ascii = ord('A')\n", + "z_ascii = ord('Z')\n", + "alphabets = [chr(i) for i in range(a_ascii, z_ascii+1)]\n", + "print(alphabets)\n", + "\n", + "numbers = np.arange(26)\n", + "\n", + "print(numbers)\n", + "\n", + "print(type(alphabets), type(numbers))\n", + "\n", + "alpha_numbers = dict(zip(alphabets, numbers))\n", + "\n", + "print(alpha_numbers)\n", + "\n", + "print(type(alpha_numbers))" + ], + "execution_count": 23, + "outputs": [ + { + "output_type": "stream", + "text": [ + "['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']\n", + "[ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23\n", + " 24 25]\n", + " \n", + "{'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7, 'I': 8, 'J': 9, 'K': 10, 'L': 11, 'M': 12, 'N': 13, 'O': 14, 'P': 15, 'Q': 16, 'R': 17, 'S': 18, 'T': 19, 'U': 20, 'V': 21, 'W': 22, 'X': 23, 'Y': 24, 'Z': 25}\n", + "\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "6ouDfjWab_Mc", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 476 + }, + "outputId": "c3baed92-3162-4d28-b60d-60be4df58ff7" + }, + "cell_type": "code", + "source": [ + "series1 = pd.Series(alphabets)\n", + "print(series1)" + ], + "execution_count": 8, + "outputs": [ + { + "output_type": "stream", + "text": [ + "0 A\n", + "1 B\n", + "2 C\n", + "3 D\n", + "4 E\n", + "5 F\n", + "6 G\n", + "7 H\n", + "8 I\n", + "9 J\n", + "10 K\n", + "11 L\n", + "12 M\n", + "13 N\n", + "14 O\n", + "15 P\n", + "16 Q\n", + "17 R\n", + "18 S\n", + "19 T\n", + "20 U\n", + "21 V\n", + "22 W\n", + "23 X\n", + "24 Y\n", + "25 Z\n", + "dtype: object\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "At7nY7vVcBZ3", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 476 + }, + "outputId": "33560d3a-e848-4b58-ac2f-d0a2899314eb" + }, + "cell_type": "code", + "source": [ + "series2 = pd.Series(numbers)\n", + "print(series2)" + ], + "execution_count": 9, + "outputs": [ + { + "output_type": "stream", + "text": [ + "0 0\n", + "1 1\n", + "2 2\n", + "3 3\n", + "4 4\n", + "5 5\n", + "6 6\n", + "7 7\n", + "8 8\n", + "9 9\n", + "10 10\n", + "11 11\n", + "12 12\n", + "13 13\n", + "14 14\n", + "15 15\n", + "16 16\n", + "17 17\n", + "18 18\n", + "19 19\n", + "20 20\n", + "21 21\n", + "22 22\n", + "23 23\n", + "24 24\n", + "25 25\n", + "dtype: int64\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "J5z-2CWAdH6N", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 476 + }, + "outputId": "edb6a388-4ca2-4c97-a2d5-590a9cecf927" + }, + "cell_type": "code", + "source": [ + "series3 = pd.Series(alpha_numbers)\n", + "print(series3)" + ], + "execution_count": 10, + "outputs": [ + { + "output_type": "stream", + "text": [ + "A 0\n", + "B 1\n", + "C 2\n", + "D 3\n", + "E 4\n", + "F 5\n", + "G 6\n", + "H 7\n", + "I 8\n", + "J 9\n", + "K 10\n", + "L 11\n", + "M 12\n", + "N 13\n", + "O 14\n", + "P 15\n", + "Q 16\n", + "R 17\n", + "S 18\n", + "T 19\n", + "U 20\n", + "V 21\n", + "W 22\n", + "X 23\n", + "Y 24\n", + "Z 25\n", + "dtype: int64\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "fYzblGGudKjO", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 170 + }, + "outputId": "b272a885-7d3e-4ffb-fc3d-3827598cb47b" + }, + "cell_type": "code", + "source": [ + "#replace head() with head(n) where n can be any number between [0-25] and observe the output in deach case \n", + "series3.head(8)" + ], + "execution_count": 11, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "A 0\n", + "B 1\n", + "C 2\n", + "D 3\n", + "E 4\n", + "F 5\n", + "G 6\n", + "H 7\n", + "dtype: int64" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 11 + } + ] + }, + { + "metadata": { + "id": "OwsJIf5feTtg", + "colab_type": "text" + }, + "cell_type": "markdown", + "source": [ + "#### Create DataFrame from lists\n", + "\n", + "[DataFrame Doc](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html)" + ] + }, + { + "metadata": { + "id": "73UTZ07EdWki", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 855 + }, + "outputId": "0a7db5ff-77d3-4a84-8b82-570bacdf9df5" + }, + "cell_type": "code", + "source": [ + "data = {'alphabets': alphabets, 'values': numbers}\n", + "\n", + "df = pd.DataFrame(data)\n", + "\n", + "#Lets Change the column `values` to `alpha_numbers`\n", + "\n", + "df.columns = ['alphabets', 'alpha_numbers']\n", + "\n", + "df" + ], + "execution_count": 26, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
alphabetsalpha_numbers
0A0
1B1
2C2
3D3
4E4
5F5
6G6
7H7
8I8
9J9
10K10
11L11
12M12
13N13
14O14
15P15
16Q16
17R17
18S18
19T19
20U20
21V21
22W22
23X23
24Y24
25Z25
\n", + "
" + ], + "text/plain": [ + " alphabets alpha_numbers\n", + "0 A 0\n", + "1 B 1\n", + "2 C 2\n", + "3 D 3\n", + "4 E 4\n", + "5 F 5\n", + "6 G 6\n", + "7 H 7\n", + "8 I 8\n", + "9 J 9\n", + "10 K 10\n", + "11 L 11\n", + "12 M 12\n", + "13 N 13\n", + "14 O 14\n", + "15 P 15\n", + "16 Q 16\n", + "17 R 17\n", + "18 S 18\n", + "19 T 19\n", + "20 U 20\n", + "21 V 21\n", + "22 W 22\n", + "23 X 23\n", + "24 Y 24\n", + "25 Z 25" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 26 + } + ] + }, + { + "metadata": { + "id": "uaK_1EO9etGS", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 140 + }, + "outputId": "6a431741-9b3b-4870-e338-0f505c585482" + }, + "cell_type": "code", + "source": [ + "# transpose\n", + "\n", + "df.T\n", + "\n", + "# there are many more operations which we can perform look at the documentation with the subsequent exercises we will learn more" + ], + "execution_count": 14, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
0123456789...16171819202122232425
alphabets0123456789...16171819202122232425
alpha_numbersABCDEFGHIJ...QRSTUVWXYZ
\n", + "

2 rows × 26 columns

\n", + "
" + ], + "text/plain": [ + " 0 1 2 3 4 5 6 7 8 9 ... 16 17 18 19 20 21 22 \\\n", + "alphabets 0 1 2 3 4 5 6 7 8 9 ... 16 17 18 19 20 21 22 \n", + "alpha_numbers A B C D E F G H I J ... Q R S T U V W \n", + "\n", + " 23 24 25 \n", + "alphabets 23 24 25 \n", + "alpha_numbers X Y Z \n", + "\n", + "[2 rows x 26 columns]" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 14 + } + ] + }, + { + "metadata": { + "id": "ZYonoaW8gEAJ", + "colab_type": "text" + }, + "cell_type": "markdown", + "source": [ + "#### Extract Items from a series" + ] + }, + { + "metadata": { + "id": "tc1-KX_Bfe7U", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 663 + }, + "outputId": "f6773c99-d093-4782-c6c5-6ab542551dc1" + }, + "cell_type": "code", + "source": [ + "ser = pd.Series(list('abcdefghijklmnopqrstuvwxyz'))\n", + "\n", + "pos = [0, 4, 8, 14, 20]\n", + "\n", + "vowels = ser.take(pos)\n", + "\n", + "df = pd.DataFrame(vowels)#, columns=['vowels'])\n", + "\n", + "df.columns = ['vowels']\n", + "df.index = [0, 1, 2, 3, 4]\n", + "\n", + "df" + ], + "execution_count": 28, + "outputs": [ + { + "output_type": "stream", + "text": [ + "0 a\n", + "1 b\n", + "2 c\n", + "3 d\n", + "4 e\n", + "5 f\n", + "6 g\n", + "7 h\n", + "8 i\n", + "9 j\n", + "10 k\n", + "11 l\n", + "12 m\n", + "13 n\n", + "14 o\n", + "15 p\n", + "16 q\n", + "17 r\n", + "18 s\n", + "19 t\n", + "20 u\n", + "21 v\n", + "22 w\n", + "23 x\n", + "24 y\n", + "25 z\n", + "dtype: object\n" + ], + "name": "stdout" + }, + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
vowels
0a
1e
2i
3o
4u
\n", + "
" + ], + "text/plain": [ + " vowels\n", + "0 a\n", + "1 e\n", + "2 i\n", + "3 o\n", + "4 u" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 28 + } + ] + }, + { + "metadata": { + "id": "cmDxwtDNjWpO", + "colab_type": "text" + }, + "cell_type": "markdown", + "source": [ + "#### Change the first character of each word to upper case in each word of ser" + ] + }, + { + "metadata": { + "id": "5KagP9PpgV2F", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "e64c7bc8-5885-46a6-fbb5-ec980e1fd35e" + }, + "cell_type": "code", + "source": [ + "ser = pd.Series(['we', 'are', 'learning', 'pandas'])\n", + "\n", + "ser.map(lambda x : x.title())\n", + "\n", + "titles = [i.title() for i in ser]\n", + "\n", + "titles" + ], + "execution_count": 17, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['We', 'Are', 'Learning', 'Pandas']" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 17 + } + ] + }, + { + "metadata": { + "id": "qn47ee-MkZN8", + "colab_type": "text" + }, + "cell_type": "markdown", + "source": [ + "#### Reindexing" + ] + }, + { + "metadata": { + "id": "h5R0JL2NjuFS", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 204 + }, + "outputId": "2bda5da8-bf7c-453c-d98f-d0c8656e5090" + }, + "cell_type": "code", + "source": [ + "my_index = [1, 2, 3, 4, 5]\n", + "\n", + "df1 = pd.DataFrame({'upper values': ['A', 'B', 'C', 'D', 'E'],\n", + " 'lower values': ['a', 'b', 'c', 'd', 'e']},\n", + " index = my_index)\n", + "\n", + "df1" + ], + "execution_count": 18, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
lower valuesupper values
1aA
2bB
3cC
4dD
5eE
\n", + "
" + ], + "text/plain": [ + " lower values upper values\n", + "1 a A\n", + "2 b B\n", + "3 c C\n", + "4 d D\n", + "5 e E" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 18 + } + ] + }, + { + "metadata": { + "id": "G_Frvc3mk93k", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 204 + }, + "outputId": "ffb3e84f-7628-4dad-f9b8-beb9993ab59b" + }, + "cell_type": "code", + "source": [ + "new_index = [2, 5, 4, 3, 1]\n", + "\n", + "df1.reindex(index = new_index)" + ], + "execution_count": 19, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
lower valuesupper values
2bB
5eE
4dD
3cC
1aA
\n", + "
" + ], + "text/plain": [ + " lower values upper values\n", + "2 b B\n", + "5 e E\n", + "4 d D\n", + "3 c C\n", + "1 a A" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 19 + } + ] + }, + { + "metadata": { + "id": "kbGHHDj-_lRK", + "colab_type": "text" + }, + "cell_type": "markdown", + "source": [ + "# Get to know your Data\n" + ] + }, + { + "metadata": { + "id": "e-L2d8nW_xhK", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "import pandas as pd\n", + "import numpy as np\n", + "iris_df = pd.read_csv('https://raw.githubusercontent.com/uiuc-cse/data-fa14/gh-pages/data/iris.csv')\n" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "0noS2eJu_-CK", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 359 + }, + "outputId": "cb7b65ff-ae80-4320-d6c6-781798ba81e7" + }, + "cell_type": "code", + "source": [ + "iris_df.head(10)" + ], + "execution_count": 30, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
05.13.51.40.2setosa
14.93.01.40.2setosa
24.73.21.30.2setosa
34.63.11.50.2setosa
45.03.61.40.2setosa
55.43.91.70.4setosa
64.63.41.40.3setosa
75.03.41.50.2setosa
84.42.91.40.2setosa
94.93.11.50.1setosa
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width species\n", + "0 5.1 3.5 1.4 0.2 setosa\n", + "1 4.9 3.0 1.4 0.2 setosa\n", + "2 4.7 3.2 1.3 0.2 setosa\n", + "3 4.6 3.1 1.5 0.2 setosa\n", + "4 5.0 3.6 1.4 0.2 setosa\n", + "5 5.4 3.9 1.7 0.4 setosa\n", + "6 4.6 3.4 1.4 0.3 setosa\n", + "7 5.0 3.4 1.5 0.2 setosa\n", + "8 4.4 2.9 1.4 0.2 setosa\n", + "9 4.9 3.1 1.5 0.1 setosa" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 30 + } + ] + }, + { + "metadata": { + "id": "AHS6dOGFABCM", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 68 + }, + "outputId": "d40b3c25-ae61-421e-da2b-ab135cd455cf" + }, + "cell_type": "code", + "source": [ + "print(iris_df.shape)\n", + "print(iris_df.shape[0])\n", + "print(iris_df.shape[1])" + ], + "execution_count": 32, + "outputs": [ + { + "output_type": "stream", + "text": [ + "(150, 5)\n", + "150\n", + "5\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "svTI74N7AJC9", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 68 + }, + "outputId": "c632fc8f-e4a7-4ae0-c3dc-7cf84b4ab909" + }, + "cell_type": "code", + "source": [ + "print(iris_df.columns)\n" + ], + "execution_count": 33, + "outputs": [ + { + "output_type": "stream", + "text": [ + "Index(['sepal_length', 'sepal_width', 'petal_length', 'petal_width',\n", + " 'species'],\n", + " dtype='object')\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "Bxc8i6avrZPw", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 221 + }, + "outputId": "c6ed98ba-bebb-4ba3-a631-9aaab5d81924" + }, + "cell_type": "code", + "source": [ + "\n", + "print(iris_df.head())\n", + "\n", + "new_index = np.random.permutation(iris_df.index)\n", + "iris_df = iris_df.reindex(index = new_index)\n", + "\n", + "print(iris_df.head())" + ], + "execution_count": 34, + "outputs": [ + { + "output_type": "stream", + "text": [ + " sepal_length sepal_width petal_length petal_width species\n", + "0 5.1 3.5 1.4 0.2 setosa\n", + "1 4.9 3.0 1.4 0.2 setosa\n", + "2 4.7 3.2 1.3 0.2 setosa\n", + "3 4.6 3.1 1.5 0.2 setosa\n", + "4 5.0 3.6 1.4 0.2 setosa\n", + " sepal_length sepal_width petal_length petal_width species\n", + "143 6.8 3.2 5.9 2.3 virginica\n", + "6 4.6 3.4 1.4 0.3 setosa\n", + "81 5.5 2.4 3.7 1.0 versicolor\n", + "27 5.2 3.5 1.5 0.2 setosa\n", + "42 4.4 3.2 1.3 0.2 setosa\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "seYXHXsYsYJI", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 323 + }, + "outputId": "3af4524f-2bbf-4b42-9907-3115e795ac81" + }, + "cell_type": "code", + "source": [ + "#original\n", + "\n", + "print(iris_df.head())\n", + "\n", + "iris_df['sepal_width'] *= 10\n", + "\n", + "#changed\n", + "\n", + "print(iris_df.head())\n", + "\n", + "#lets undo the operation\n", + "\n", + "iris_df['sepal_width'] /= 10\n", + "\n", + "print(iris_df.head())" + ], + "execution_count": 35, + "outputs": [ + { + "output_type": "stream", + "text": [ + " sepal_length sepal_width petal_length petal_width species\n", + "143 6.8 3.2 5.9 2.3 virginica\n", + "6 4.6 3.4 1.4 0.3 setosa\n", + "81 5.5 2.4 3.7 1.0 versicolor\n", + "27 5.2 3.5 1.5 0.2 setosa\n", + "42 4.4 3.2 1.3 0.2 setosa\n", + " sepal_length sepal_width petal_length petal_width species\n", + "143 6.8 32.0 5.9 2.3 virginica\n", + "6 4.6 34.0 1.4 0.3 setosa\n", + "81 5.5 24.0 3.7 1.0 versicolor\n", + "27 5.2 35.0 1.5 0.2 setosa\n", + "42 4.4 32.0 1.3 0.2 setosa\n", + " sepal_length sepal_width petal_length petal_width species\n", + "143 6.8 3.2 5.9 2.3 virginica\n", + "6 4.6 3.4 1.4 0.3 setosa\n", + "81 5.5 2.4 3.7 1.0 versicolor\n", + "27 5.2 3.5 1.5 0.2 setosa\n", + "42 4.4 3.2 1.3 0.2 setosa\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "WJ7W-F-d0AoZ", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 1165 + }, + "outputId": "f8ba0624-fda2-4742-f8b9-1c0ba147d373" + }, + "cell_type": "code", + "source": [ + "iris_df[iris_df['sepal_width']>3.3]" + ], + "execution_count": 36, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
64.63.41.40.3setosa
275.23.51.50.2setosa
335.54.21.40.2setosa
195.13.81.50.3setosa
55.43.91.70.4setosa
285.23.41.40.2setosa
224.63.61.00.2setosa
1317.93.86.42.0virginica
185.73.81.70.3setosa
856.03.44.51.6versicolor
215.13.71.50.4setosa
75.03.41.50.2setosa
175.13.51.40.3setosa
165.43.91.30.4setosa
365.53.51.30.2setosa
155.74.41.50.4setosa
395.13.41.50.2setosa
05.13.51.40.2setosa
45.03.61.40.2setosa
325.24.11.50.1setosa
244.83.41.90.2setosa
265.03.41.60.4setosa
1366.33.45.62.4virginica
405.03.51.30.3setosa
465.13.81.60.2setosa
315.43.41.50.4setosa
435.03.51.60.6setosa
114.83.41.60.2setosa
445.13.81.90.4setosa
1177.73.86.72.2virginica
105.43.71.50.2setosa
145.84.01.20.2setosa
485.33.71.50.2setosa
205.43.41.70.2setosa
1486.23.45.42.3virginica
1097.23.66.12.5virginica
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width species\n", + "6 4.6 3.4 1.4 0.3 setosa\n", + "27 5.2 3.5 1.5 0.2 setosa\n", + "33 5.5 4.2 1.4 0.2 setosa\n", + "19 5.1 3.8 1.5 0.3 setosa\n", + "5 5.4 3.9 1.7 0.4 setosa\n", + "28 5.2 3.4 1.4 0.2 setosa\n", + "22 4.6 3.6 1.0 0.2 setosa\n", + "131 7.9 3.8 6.4 2.0 virginica\n", + "18 5.7 3.8 1.7 0.3 setosa\n", + "85 6.0 3.4 4.5 1.6 versicolor\n", + "21 5.1 3.7 1.5 0.4 setosa\n", + "7 5.0 3.4 1.5 0.2 setosa\n", + "17 5.1 3.5 1.4 0.3 setosa\n", + "16 5.4 3.9 1.3 0.4 setosa\n", + "36 5.5 3.5 1.3 0.2 setosa\n", + "15 5.7 4.4 1.5 0.4 setosa\n", + "39 5.1 3.4 1.5 0.2 setosa\n", + "0 5.1 3.5 1.4 0.2 setosa\n", + "4 5.0 3.6 1.4 0.2 setosa\n", + "32 5.2 4.1 1.5 0.1 setosa\n", + "24 4.8 3.4 1.9 0.2 setosa\n", + "26 5.0 3.4 1.6 0.4 setosa\n", + "136 6.3 3.4 5.6 2.4 virginica\n", + "40 5.0 3.5 1.3 0.3 setosa\n", + "46 5.1 3.8 1.6 0.2 setosa\n", + "31 5.4 3.4 1.5 0.4 setosa\n", + "43 5.0 3.5 1.6 0.6 setosa\n", + "11 4.8 3.4 1.6 0.2 setosa\n", + "44 5.1 3.8 1.9 0.4 setosa\n", + "117 7.7 3.8 6.7 2.2 virginica\n", + "10 5.4 3.7 1.5 0.2 setosa\n", + "14 5.8 4.0 1.2 0.2 setosa\n", + "48 5.3 3.7 1.5 0.2 setosa\n", + "20 5.4 3.4 1.7 0.2 setosa\n", + "148 6.2 3.4 5.4 2.3 virginica\n", + "109 7.2 3.6 6.1 2.5 virginica" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 36 + } + ] + }, + { + "metadata": { + "id": "4U7ksr_R2H7M", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 80 + }, + "outputId": "81f4773f-80b7-4f47-ee31-761f0c0f38ea" + }, + "cell_type": "code", + "source": [ + "iris_df[(iris_df['sepal_width']>3.3) & (iris_df['species'] == 'versicolor')] " + ], + "execution_count": 37, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
856.03.44.51.6versicolor
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width species\n", + "85 6.0 3.4 4.5 1.6 versicolor" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 37 + } + ] + }, + { + "metadata": { + "id": "ntegaw7oA2_Y", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "M6EN78ufoJY7", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "a872e669-acf0-4e67-ab10-9b55612889e6" + }, + "cell_type": "code", + "source": [ + "species = iris_df['species'].unique()\n", + "\n", + "print(species)" + ], + "execution_count": 38, + "outputs": [ + { + "output_type": "stream", + "text": [ + "['virginica' 'setosa' 'versicolor']\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "gZvpbKBwoVUe", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 204 + }, + "outputId": "5a81e11e-9e8f-481d-8c6d-58a2915a6966" + }, + "cell_type": "code", + "source": [ + "setosa = iris_df[iris_df['species'] == species[0]]\n", + "\n", + "setosa.head()" + ], + "execution_count": 39, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
1436.83.25.92.3virginica
1276.13.04.91.8virginica
1257.23.26.01.8virginica
1135.72.55.02.0virginica
1446.73.35.72.5virginica
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width species\n", + "143 6.8 3.2 5.9 2.3 virginica\n", + "127 6.1 3.0 4.9 1.8 virginica\n", + "125 7.2 3.2 6.0 1.8 virginica\n", + "113 5.7 2.5 5.0 2.0 virginica\n", + "144 6.7 3.3 5.7 2.5 virginica" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 39 + } + ] + }, + { + "metadata": { + "id": "7tumfZ3DotPG", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 204 + }, + "outputId": "534b33f7-1f4a-43ad-d4ac-316a59e0b22a" + }, + "cell_type": "code", + "source": [ + " \n", + "versicolor = iris_df[iris_df['species'] == species[1]]\n", + "\n", + "versicolor.head()" + ], + "execution_count": 44, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
64.63.41.40.3setosa
275.23.51.50.2setosa
424.43.21.30.2setosa
335.54.21.40.2setosa
195.13.81.50.3setosa
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width species\n", + "6 4.6 3.4 1.4 0.3 setosa\n", + "27 5.2 3.5 1.5 0.2 setosa\n", + "42 4.4 3.2 1.3 0.2 setosa\n", + "33 5.5 4.2 1.4 0.2 setosa\n", + "19 5.1 3.8 1.5 0.3 setosa" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 44 + } + ] + }, + { + "metadata": { + "id": "JI75_hQcBgoz", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "cUYm5UqVpDPy", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 204 + }, + "outputId": "356926ed-ad6b-4eec-88c9-5cf22f2cb3ed" + }, + "cell_type": "code", + "source": [ + "\n", + "\n", + "virginica = iris_df[iris_df['species'] == species[2]]\n", + "\n", + "virginica.head()" + ], + "execution_count": 41, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
815.52.43.71.0versicolor
766.82.84.81.4versicolor
546.52.84.61.5versicolor
925.82.64.01.2versicolor
825.82.73.91.2versicolor
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width species\n", + "81 5.5 2.4 3.7 1.0 versicolor\n", + "76 6.8 2.8 4.8 1.4 versicolor\n", + "54 6.5 2.8 4.6 1.5 versicolor\n", + "92 5.8 2.6 4.0 1.2 versicolor\n", + "82 5.8 2.7 3.9 1.2 versicolor" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 41 + } + ] + }, + { + "metadata": { + "id": "K7KIj6fv2zWP", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 1969 + }, + "outputId": "c758c995-f849-4942-e01c-335be5305594" + }, + "cell_type": "code", + "source": [ + "iris_df.sort_values(by='sepal_width')" + ], + "execution_count": 43, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
605.02.03.51.0versicolor
626.02.24.01.0versicolor
686.22.24.51.5versicolor
1196.02.25.01.5virginica
935.02.33.31.0versicolor
535.52.34.01.3versicolor
414.52.31.30.3setosa
876.32.34.41.3versicolor
815.52.43.71.0versicolor
805.52.43.81.1versicolor
574.92.43.31.0versicolor
1135.72.55.02.0virginica
895.52.54.01.3versicolor
1064.92.54.51.7virginica
1086.72.55.81.8virginica
695.62.53.91.1versicolor
1466.32.55.01.9virginica
726.32.54.91.5versicolor
985.12.53.01.1versicolor
905.52.64.41.2versicolor
795.72.63.51.0versicolor
1346.12.65.61.4virginica
925.82.64.01.2versicolor
1187.72.66.92.3virginica
1236.32.74.91.8virginica
836.02.75.11.6versicolor
825.82.73.91.2versicolor
1425.82.75.11.9virginica
595.22.73.91.4versicolor
1015.82.75.11.9virginica
..................
856.03.44.51.6versicolor
205.43.41.70.2setosa
1486.23.45.42.3virginica
285.23.41.40.2setosa
75.03.41.50.2setosa
315.43.41.50.4setosa
275.23.51.50.2setosa
405.03.51.30.3setosa
435.03.51.60.6setosa
05.13.51.40.2setosa
175.13.51.40.3setosa
365.53.51.30.2setosa
224.63.61.00.2setosa
1097.23.66.12.5virginica
45.03.61.40.2setosa
215.13.71.50.4setosa
485.33.71.50.2setosa
105.43.71.50.2setosa
1317.93.86.42.0virginica
185.73.81.70.3setosa
195.13.81.50.3setosa
1177.73.86.72.2virginica
445.13.81.90.4setosa
465.13.81.60.2setosa
165.43.91.30.4setosa
55.43.91.70.4setosa
145.84.01.20.2setosa
325.24.11.50.1setosa
335.54.21.40.2setosa
155.74.41.50.4setosa
\n", + "

150 rows × 5 columns

\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width species\n", + "60 5.0 2.0 3.5 1.0 versicolor\n", + "62 6.0 2.2 4.0 1.0 versicolor\n", + "68 6.2 2.2 4.5 1.5 versicolor\n", + "119 6.0 2.2 5.0 1.5 virginica\n", + "93 5.0 2.3 3.3 1.0 versicolor\n", + "53 5.5 2.3 4.0 1.3 versicolor\n", + "41 4.5 2.3 1.3 0.3 setosa\n", + "87 6.3 2.3 4.4 1.3 versicolor\n", + "81 5.5 2.4 3.7 1.0 versicolor\n", + "80 5.5 2.4 3.8 1.1 versicolor\n", + "57 4.9 2.4 3.3 1.0 versicolor\n", + "113 5.7 2.5 5.0 2.0 virginica\n", + "89 5.5 2.5 4.0 1.3 versicolor\n", + "106 4.9 2.5 4.5 1.7 virginica\n", + "108 6.7 2.5 5.8 1.8 virginica\n", + "69 5.6 2.5 3.9 1.1 versicolor\n", + "146 6.3 2.5 5.0 1.9 virginica\n", + "72 6.3 2.5 4.9 1.5 versicolor\n", + "98 5.1 2.5 3.0 1.1 versicolor\n", + "90 5.5 2.6 4.4 1.2 versicolor\n", + "79 5.7 2.6 3.5 1.0 versicolor\n", + "134 6.1 2.6 5.6 1.4 virginica\n", + "92 5.8 2.6 4.0 1.2 versicolor\n", + "118 7.7 2.6 6.9 2.3 virginica\n", + "123 6.3 2.7 4.9 1.8 virginica\n", + "83 6.0 2.7 5.1 1.6 versicolor\n", + "82 5.8 2.7 3.9 1.2 versicolor\n", + "142 5.8 2.7 5.1 1.9 virginica\n", + "59 5.2 2.7 3.9 1.4 versicolor\n", + "101 5.8 2.7 5.1 1.9 virginica\n", + ".. ... ... ... ... ...\n", + "85 6.0 3.4 4.5 1.6 versicolor\n", + "20 5.4 3.4 1.7 0.2 setosa\n", + "148 6.2 3.4 5.4 2.3 virginica\n", + "28 5.2 3.4 1.4 0.2 setosa\n", + "7 5.0 3.4 1.5 0.2 setosa\n", + "31 5.4 3.4 1.5 0.4 setosa\n", + "27 5.2 3.5 1.5 0.2 setosa\n", + "40 5.0 3.5 1.3 0.3 setosa\n", + "43 5.0 3.5 1.6 0.6 setosa\n", + "0 5.1 3.5 1.4 0.2 setosa\n", + "17 5.1 3.5 1.4 0.3 setosa\n", + "36 5.5 3.5 1.3 0.2 setosa\n", + "22 4.6 3.6 1.0 0.2 setosa\n", + "109 7.2 3.6 6.1 2.5 virginica\n", + "4 5.0 3.6 1.4 0.2 setosa\n", + "21 5.1 3.7 1.5 0.4 setosa\n", + "48 5.3 3.7 1.5 0.2 setosa\n", + "10 5.4 3.7 1.5 0.2 setosa\n", + "131 7.9 3.8 6.4 2.0 virginica\n", + "18 5.7 3.8 1.7 0.3 setosa\n", + "19 5.1 3.8 1.5 0.3 setosa\n", + "117 7.7 3.8 6.7 2.2 virginica\n", + "44 5.1 3.8 1.9 0.4 setosa\n", + "46 5.1 3.8 1.6 0.2 setosa\n", + "16 5.4 3.9 1.3 0.4 setosa\n", + "5 5.4 3.9 1.7 0.4 setosa\n", + "14 5.8 4.0 1.2 0.2 setosa\n", + "32 5.2 4.1 1.5 0.1 setosa\n", + "33 5.5 4.2 1.4 0.2 setosa\n", + "15 5.7 4.4 1.5 0.4 setosa\n", + "\n", + "[150 rows x 5 columns]" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 43 + } + ] + }, + { + "metadata": { + "id": "Xh-qeZYsB0s4", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "eHrn3ZVRpOk5", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 297 + }, + "outputId": "d092f3ee-4850-4ab1-e15e-95b3ca3c789d" + }, + "cell_type": "code", + "source": [ + "setosa.describe()" + ], + "execution_count": 47, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_width
count50.0000050.00000050.00000050.00000
mean6.588002.9740005.5520002.02600
std0.635880.3224970.5518950.27465
min4.900002.2000004.5000001.40000
25%6.225002.8000005.1000001.80000
50%6.500003.0000005.5500002.00000
75%6.900003.1750005.8750002.30000
max7.900003.8000006.9000002.50000
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width\n", + "count 50.00000 50.000000 50.000000 50.00000\n", + "mean 6.58800 2.974000 5.552000 2.02600\n", + "std 0.63588 0.322497 0.551895 0.27465\n", + "min 4.90000 2.200000 4.500000 1.40000\n", + "25% 6.22500 2.800000 5.100000 1.80000\n", + "50% 6.50000 3.000000 5.550000 2.00000\n", + "75% 6.90000 3.175000 5.875000 2.30000\n", + "max 7.90000 3.800000 6.900000 2.50000" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 47 + } + ] + }, + { + "metadata": { + "id": "GwJFT2GlpwUv", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 297 + }, + "outputId": "2eabe02c-93a5-4a84-ce12-fc477c2fb1f8" + }, + "cell_type": "code", + "source": [ + "versicolor.describe()" + ], + "execution_count": 48, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_width
count50.0000050.00000050.00000050.00000
mean5.006003.4180001.4640000.24400
std0.352490.3810240.1735110.10721
min4.300002.3000001.0000000.10000
25%4.800003.1250001.4000000.20000
50%5.000003.4000001.5000000.20000
75%5.200003.6750001.5750000.30000
max5.800004.4000001.9000000.60000
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width\n", + "count 50.00000 50.000000 50.000000 50.00000\n", + "mean 5.00600 3.418000 1.464000 0.24400\n", + "std 0.35249 0.381024 0.173511 0.10721\n", + "min 4.30000 2.300000 1.000000 0.10000\n", + "25% 4.80000 3.125000 1.400000 0.20000\n", + "50% 5.00000 3.400000 1.500000 0.20000\n", + "75% 5.20000 3.675000 1.575000 0.30000\n", + "max 5.80000 4.400000 1.900000 0.60000" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 48 + } + ] + }, + { + "metadata": { + "id": "Ad4qhSZLpztf", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 297 + }, + "outputId": "fe5aee87-e1ce-4930-fb14-ecb6099e54ef" + }, + "cell_type": "code", + "source": [ + "virginica.describe()" + ], + "execution_count": 49, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sepal_lengthsepal_widthpetal_lengthpetal_width
count50.00000050.00000050.00000050.000000
mean5.9360002.7700004.2600001.326000
std0.5161710.3137980.4699110.197753
min4.9000002.0000003.0000001.000000
25%5.6000002.5250004.0000001.200000
50%5.9000002.8000004.3500001.300000
75%6.3000003.0000004.6000001.500000
max7.0000003.4000005.1000001.800000
\n", + "
" + ], + "text/plain": [ + " sepal_length sepal_width petal_length petal_width\n", + "count 50.000000 50.000000 50.000000 50.000000\n", + "mean 5.936000 2.770000 4.260000 1.326000\n", + "std 0.516171 0.313798 0.469911 0.197753\n", + "min 4.900000 2.000000 3.000000 1.000000\n", + "25% 5.600000 2.525000 4.000000 1.200000\n", + "50% 5.900000 2.800000 4.350000 1.300000\n", + "75% 6.300000 3.000000 4.600000 1.500000\n", + "max 7.000000 3.400000 5.100000 1.800000" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 49 + } + ] + }, + { + "metadata": { + "id": "rqDXuuAtt7C3", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 398 + }, + "outputId": "a2a7a6c1-e31e-499e-a64c-4b67441764e9" + }, + "cell_type": "code", + "source": [ + "import matplotlib.pyplot as plt\n", + "\n", + "#hist creates a histogram there are many more plots(see the documentation) you can play with it.\n", + "\n", + "plt.hist(setosa['sepal_length'])\n", + "plt.hist(versicolor['sepal_length'])\n", + "plt.hist(virginica['sepal_length'])" + ], + "execution_count": 50, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(array([ 4., 1., 6., 10., 5., 8., 5., 3., 5., 3.]),\n", + " array([4.9 , 5.11, 5.32, 5.53, 5.74, 5.95, 6.16, 6.37, 6.58, 6.79, 7. ]),\n", + "
)" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 50 + }, + { + "output_type": "display_data", + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAd8AAAFKCAYAAABcq1WoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+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QiIg4duxYPPXUU3HmzJmIiPjzn//c+r9qi0VjY2Ms\nXbo0Iv79EuWHH37Y+j9FP/vZz8bx48dj7969ce7cudi4cWPce++9hRz3qrW1vlLYv4iIoUOHxpYt\nW+Kjjz6K5ubmOHnyZOt7TqWwh22tr1T2MOLf3xhVVlZ+7FWnL3/5y/H3v/89Wlpa4sSJE7Ft27a4\n6667CjRl7i63vn/+858xa9asyGazce7cudi2bVvR7WH//v1j+/btERGxb9++qKysbP3f2h3dvy77\nsvOlrFmzJqqqqmLUqFExfPjwqKuri+uuuy6+9KUvFd3LXSNGjIjvf//7sWHDhjh79mw0NDTEb3/7\n29b1NTQ0xKxZsyIi4sEHH4ybb765wBNfnfbWV+z7F/HvZ/djxoyJ8ePHR0TE/PnzY+3atSWzh+2t\nrxT2MOLj78//4he/iLvvvjsGDhwYs2bNiqeeeirKysqivr4+qqry/xvgOltb6+vTp09861vfim7d\nusWIESNiwIABBZz06tXV1cW8efNi8uTJce7cuWhoaMjb/vl4SQBIrMu+7AwAhSK+AJCY+AJAYuIL\nAImJLwAkJr4AkJj4AkBi4gsAif1/UFKJ1QILF/YAAAAASUVORK5CYII=\n", + "text/plain": [ + "" + ] + }, + "metadata": { + "tags": [] + } + } + ] + }, + { + "metadata": { + "id": "73HXgh3eCK2E", + "colab_type": "text" + }, + "cell_type": "markdown", + "source": [ + "# PANDAS EXERCISE" + ] + }, + { + "metadata": { + "id": "bqhO1k1mCoVi", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "c3_UBbMRhiKx", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "import numpy as np\n", + "import pandas as pd" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "qb0-G6KUC90e", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 238 + }, + "outputId": "0df75682-3686-4ba5-8dcd-3c728be596c7" + }, + "cell_type": "code", + "source": [ + "wine=pd.read_csv(\"https://archive.ics.uci.edu/ml/machine-learning-databases/wine/wine.data\" )\n", + "print(wine.head(5))" + ], + "execution_count": 52, + "outputs": [ + { + "output_type": "stream", + "text": [ + " 1 14.23 1.71 2.43 15.6 127 2.8 3.06 .28 2.29 5.64 1.04 3.92 \\\n", + "0 1 13.20 1.78 2.14 11.2 100 2.65 2.76 0.26 1.28 4.38 1.05 3.40 \n", + "1 1 13.16 2.36 2.67 18.6 101 2.80 3.24 0.30 2.81 5.68 1.03 3.17 \n", + "2 1 14.37 1.95 2.50 16.8 113 3.85 3.49 0.24 2.18 7.80 0.86 3.45 \n", + "3 1 13.24 2.59 2.87 21.0 118 2.80 2.69 0.39 1.82 4.32 1.04 2.93 \n", + "4 1 14.20 1.76 2.45 15.2 112 3.27 3.39 0.34 1.97 6.75 1.05 2.85 \n", + "\n", + " 1065 \n", + "0 1050 \n", + "1 1185 \n", + "2 1480 \n", + "3 735 \n", + "4 1450 \n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "YNNHZim_LWs0", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 2274 + }, + "outputId": "b17fb629-3279-4d0a-91d2-0d61b279ba7b" + }, + "cell_type": "code", + "source": [ + "wine_df_copy=pd.DataFrame(wine)\n", + "#print(wine_df_copy)\n", + "wine_df_copy=wine_df_copy.drop(wine_df_copy.index[1::2])\n", + "print(wine_df_copy)" + ], + "execution_count": 57, + "outputs": [ + { + "output_type": "stream", + "text": [ + " 1 14.23 1.71 2.43 15.6 127 2.8 3.06 .28 2.29 5.64 1.04 \\\n", + "0 1 13.20 1.78 2.14 11.2 100 2.65 2.76 0.26 1.28 4.380000 1.05 \n", + "2 1 14.37 1.95 2.50 16.8 113 3.85 3.49 0.24 2.18 7.800000 0.86 \n", + "4 1 14.20 1.76 2.45 15.2 112 3.27 3.39 0.34 1.97 6.750000 1.05 \n", + "6 1 14.06 2.15 2.61 17.6 121 2.60 2.51 0.31 1.25 5.050000 1.06 \n", + "8 1 13.86 1.35 2.27 16.0 98 2.98 3.15 0.22 1.85 7.220000 1.01 \n", + "10 1 14.12 1.48 2.32 16.8 95 2.20 2.43 0.26 1.57 5.000000 1.17 \n", + "12 1 14.75 1.73 2.39 11.4 91 3.10 3.69 0.43 2.81 5.400000 1.25 \n", + "14 1 13.63 1.81 2.70 17.2 112 2.85 2.91 0.30 1.46 7.300000 1.28 \n", + "16 1 13.83 1.57 2.62 20.0 115 2.95 3.40 0.40 1.72 6.600000 1.13 \n", + "18 1 13.64 3.10 2.56 15.2 116 2.70 3.03 0.17 1.66 5.100000 0.96 \n", + "20 1 12.93 3.80 2.65 18.6 102 2.41 2.41 0.25 1.98 4.500000 1.03 \n", + "22 1 12.85 1.60 2.52 17.8 95 2.48 2.37 0.26 1.46 3.930000 1.09 \n", + "24 1 13.05 2.05 3.22 25.0 124 2.63 2.68 0.47 1.92 3.580000 1.13 \n", + "26 1 13.30 1.72 2.14 17.0 94 2.40 2.19 0.27 1.35 3.950000 1.02 \n", + "28 1 14.02 1.68 2.21 16.0 96 2.65 2.33 0.26 1.98 4.700000 1.04 \n", + "30 1 13.58 1.66 2.36 19.1 106 2.86 3.19 0.22 1.95 6.900000 1.09 \n", + "32 1 13.76 1.53 2.70 19.5 132 2.95 2.74 0.50 1.35 5.400000 1.25 \n", + "34 1 13.48 1.81 2.41 20.5 100 2.70 2.98 0.26 1.86 5.100000 1.04 \n", + "36 1 13.05 1.65 2.55 18.0 98 2.45 2.43 0.29 1.44 4.250000 1.12 \n", + "38 1 14.22 3.99 2.51 13.2 128 3.00 3.04 0.20 2.08 5.100000 0.89 \n", + "40 1 13.41 3.84 2.12 18.8 90 2.45 2.68 0.27 1.48 4.280000 0.91 \n", + "42 1 13.24 3.98 2.29 17.5 103 2.64 2.63 0.32 1.66 4.360000 0.82 \n", + "44 1 14.21 4.04 2.44 18.9 111 2.85 2.65 0.30 1.25 5.240000 0.87 \n", + "46 1 13.90 1.68 2.12 16.0 101 3.10 3.39 0.21 2.14 6.100000 0.91 \n", + "48 1 13.94 1.73 2.27 17.4 108 2.88 3.54 0.32 2.08 8.900000 1.12 \n", + "50 1 13.83 1.65 2.60 17.2 94 2.45 2.99 0.22 2.29 5.600000 1.24 \n", + "52 1 13.77 1.90 2.68 17.1 115 3.00 2.79 0.39 1.68 6.300000 1.13 \n", + "54 1 13.56 1.73 2.46 20.5 116 2.96 2.78 0.20 2.45 6.250000 0.98 \n", + "56 1 13.29 1.97 2.68 16.8 102 3.00 3.23 0.31 1.66 6.000000 1.07 \n", + "58 2 12.37 0.94 1.36 10.6 88 1.98 0.57 0.28 0.42 1.950000 1.05 \n", + ".. .. ... ... ... ... ... ... ... ... ... ... ... \n", + "118 2 12.00 3.43 2.00 19.0 87 2.00 1.64 0.37 1.87 1.280000 0.93 \n", + "120 2 11.56 2.05 3.23 28.5 119 3.18 5.08 0.47 1.87 6.000000 0.93 \n", + "122 2 13.05 5.80 2.13 21.5 86 2.62 2.65 0.30 2.01 2.600000 0.73 \n", + "124 2 12.07 2.16 2.17 21.0 85 2.60 2.65 0.37 1.35 2.760000 0.86 \n", + "126 2 11.79 2.13 2.78 28.5 92 2.13 2.24 0.58 1.76 3.000000 0.97 \n", + "128 2 12.04 4.30 2.38 22.0 80 2.10 1.75 0.42 1.35 2.600000 0.79 \n", + "130 3 12.88 2.99 2.40 20.0 104 1.30 1.22 0.24 0.83 5.400000 0.74 \n", + "132 3 12.70 3.55 2.36 21.5 106 1.70 1.20 0.17 0.84 5.000000 0.78 \n", + "134 3 12.60 2.46 2.20 18.5 94 1.62 0.66 0.63 0.94 7.100000 0.73 \n", + "136 3 12.53 5.51 2.64 25.0 96 1.79 0.60 0.63 1.10 5.000000 0.82 \n", + "138 3 12.84 2.96 2.61 24.0 101 2.32 0.60 0.53 0.81 4.920000 0.89 \n", + "140 3 13.36 2.56 2.35 20.0 89 1.40 0.50 0.37 0.64 5.600000 0.70 \n", + "142 3 13.62 4.95 2.35 20.0 92 2.00 0.80 0.47 1.02 4.400000 0.91 \n", + "144 3 13.16 3.57 2.15 21.0 102 1.50 0.55 0.43 1.30 4.000000 0.60 \n", + "146 3 12.87 4.61 2.48 21.5 86 1.70 0.65 0.47 0.86 7.650000 0.54 \n", + "148 3 13.08 3.90 2.36 21.5 113 1.41 1.39 0.34 1.14 9.400000 0.57 \n", + "150 3 12.79 2.67 2.48 22.0 112 1.48 1.36 0.24 1.26 10.800000 0.48 \n", + "152 3 13.23 3.30 2.28 18.5 98 1.80 0.83 0.61 1.87 10.520000 0.56 \n", + "154 3 13.17 5.19 2.32 22.0 93 1.74 0.63 0.61 1.55 7.900000 0.60 \n", + "156 3 12.45 3.03 2.64 27.0 97 1.90 0.58 0.63 1.14 7.500000 0.67 \n", + "158 3 13.48 1.67 2.64 22.5 89 2.60 1.10 0.52 2.29 11.750000 0.57 \n", + "160 3 13.69 3.26 2.54 20.0 107 1.83 0.56 0.50 0.80 5.880000 0.96 \n", + "162 3 12.96 3.45 2.35 18.5 106 1.39 0.70 0.40 0.94 5.280000 0.68 \n", + "164 3 13.73 4.36 2.26 22.5 88 1.28 0.47 0.52 1.15 6.620000 0.78 \n", + "166 3 12.82 3.37 2.30 19.5 88 1.48 0.66 0.40 0.97 10.260000 0.72 \n", + "168 3 13.40 4.60 2.86 25.0 112 1.98 0.96 0.27 1.11 8.500000 0.67 \n", + "170 3 12.77 2.39 2.28 19.5 86 1.39 0.51 0.48 0.64 9.899999 0.57 \n", + "172 3 13.71 5.65 2.45 20.5 95 1.68 0.61 0.52 1.06 7.700000 0.64 \n", + "174 3 13.27 4.28 2.26 20.0 120 1.59 0.69 0.43 1.35 10.200000 0.59 \n", + "176 3 14.13 4.10 2.74 24.5 96 2.05 0.76 0.56 1.35 9.200000 0.61 \n", + "\n", + " 3.92 1065 \n", + "0 3.40 1050 \n", + "2 3.45 1480 \n", + "4 2.85 1450 \n", + "6 3.58 1295 \n", + "8 3.55 1045 \n", + "10 2.82 1280 \n", + "12 2.73 1150 \n", + "14 2.88 1310 \n", + "16 2.57 1130 \n", + "18 3.36 845 \n", + "20 3.52 770 \n", + "22 3.63 1015 \n", + "24 3.20 830 \n", + "26 2.77 1285 \n", + "28 3.59 1035 \n", + "30 2.88 1515 \n", + "32 3.00 1235 \n", + "34 3.47 920 \n", + "36 2.51 1105 \n", + "38 3.53 760 \n", + "40 3.00 1035 \n", + "42 3.00 680 \n", + "44 3.33 1080 \n", + "46 3.33 985 \n", + "48 3.10 1260 \n", + "50 3.37 1265 \n", + "52 2.93 1375 \n", + "54 3.03 1120 \n", + "56 2.84 1270 \n", + "58 1.82 520 \n", + ".. ... ... \n", + "118 3.05 564 \n", + "120 3.69 465 \n", + "122 3.10 380 \n", + "124 3.28 378 \n", + "126 2.44 466 \n", + "128 2.57 580 \n", + "130 1.42 530 \n", + "132 1.29 600 \n", + "134 1.58 695 \n", + "136 1.69 515 \n", + "138 2.15 590 \n", + "140 2.47 780 \n", + "142 2.05 550 \n", + "144 1.68 830 \n", + "146 1.86 625 \n", + "148 1.33 550 \n", + "150 1.47 480 \n", + "152 1.51 675 \n", + "154 1.48 725 \n", + "156 1.73 880 \n", + "158 1.78 620 \n", + "160 1.82 680 \n", + "162 1.75 675 \n", + "164 1.75 520 \n", + "166 1.75 685 \n", + "168 1.92 630 \n", + "170 1.63 470 \n", + "172 1.74 740 \n", + "174 1.56 835 \n", + "176 1.60 560 \n", + "\n", + "[89 rows x 14 columns]\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "JZ9KlzdJMSyu", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "wine_df_copy.columns = ['Alcohol','Malic acid','Ash','Alcalinity of ash','Magnesium','Total phenols','Flavanoids','Nonflavanoid phenols','Proanthocyanins','Color intensity','Hue','OD280/OD315 of diluted wines','Proline','calcium']" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "pqk54CldMWj8", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 3310 + }, + "outputId": "6d526a9d-6243-487e-924c-0a962020842f" + }, + "cell_type": "code", + "source": [ + "print(wine_df_copy)" + ], + "execution_count": 60, + "outputs": [ + { + "output_type": "stream", + "text": [ + " Alcohol Malic acid Ash Alcalinity of ash Magnesium Total phenols \\\n", + "0 1 13.20 1.78 2.14 11.2 100 \n", + "2 1 14.37 1.95 2.50 16.8 113 \n", + "4 1 14.20 1.76 2.45 15.2 112 \n", + "6 1 14.06 2.15 2.61 17.6 121 \n", + "8 1 13.86 1.35 2.27 16.0 98 \n", + "10 1 14.12 1.48 2.32 16.8 95 \n", + "12 1 14.75 1.73 2.39 11.4 91 \n", + "14 1 13.63 1.81 2.70 17.2 112 \n", + "16 1 13.83 1.57 2.62 20.0 115 \n", + "18 1 13.64 3.10 2.56 15.2 116 \n", + "20 1 12.93 3.80 2.65 18.6 102 \n", + "22 1 12.85 1.60 2.52 17.8 95 \n", + "24 1 13.05 2.05 3.22 25.0 124 \n", + "26 1 13.30 1.72 2.14 17.0 94 \n", + "28 1 14.02 1.68 2.21 16.0 96 \n", + "30 1 13.58 1.66 2.36 19.1 106 \n", + "32 1 13.76 1.53 2.70 19.5 132 \n", + "34 1 13.48 1.81 2.41 20.5 100 \n", + "36 1 13.05 1.65 2.55 18.0 98 \n", + "38 1 14.22 3.99 2.51 13.2 128 \n", + "40 1 13.41 3.84 2.12 18.8 90 \n", + "42 1 13.24 3.98 2.29 17.5 103 \n", + "44 1 14.21 4.04 2.44 18.9 111 \n", + "46 1 13.90 1.68 2.12 16.0 101 \n", + "48 1 13.94 1.73 2.27 17.4 108 \n", + "50 1 13.83 1.65 2.60 17.2 94 \n", + "52 1 13.77 1.90 2.68 17.1 115 \n", + "54 1 13.56 1.73 2.46 20.5 116 \n", + "56 1 13.29 1.97 2.68 16.8 102 \n", + "58 2 12.37 0.94 1.36 10.6 88 \n", + ".. ... ... ... ... ... ... \n", + "118 2 12.00 3.43 2.00 19.0 87 \n", + "120 2 11.56 2.05 3.23 28.5 119 \n", + "122 2 13.05 5.80 2.13 21.5 86 \n", + "124 2 12.07 2.16 2.17 21.0 85 \n", + "126 2 11.79 2.13 2.78 28.5 92 \n", + "128 2 12.04 4.30 2.38 22.0 80 \n", + "130 3 12.88 2.99 2.40 20.0 104 \n", + "132 3 12.70 3.55 2.36 21.5 106 \n", + "134 3 12.60 2.46 2.20 18.5 94 \n", + "136 3 12.53 5.51 2.64 25.0 96 \n", + "138 3 12.84 2.96 2.61 24.0 101 \n", + "140 3 13.36 2.56 2.35 20.0 89 \n", + "142 3 13.62 4.95 2.35 20.0 92 \n", + "144 3 13.16 3.57 2.15 21.0 102 \n", + "146 3 12.87 4.61 2.48 21.5 86 \n", + "148 3 13.08 3.90 2.36 21.5 113 \n", + "150 3 12.79 2.67 2.48 22.0 112 \n", + "152 3 13.23 3.30 2.28 18.5 98 \n", + "154 3 13.17 5.19 2.32 22.0 93 \n", + "156 3 12.45 3.03 2.64 27.0 97 \n", + "158 3 13.48 1.67 2.64 22.5 89 \n", + "160 3 13.69 3.26 2.54 20.0 107 \n", + "162 3 12.96 3.45 2.35 18.5 106 \n", + "164 3 13.73 4.36 2.26 22.5 88 \n", + "166 3 12.82 3.37 2.30 19.5 88 \n", + "168 3 13.40 4.60 2.86 25.0 112 \n", + "170 3 12.77 2.39 2.28 19.5 86 \n", + "172 3 13.71 5.65 2.45 20.5 95 \n", + "174 3 13.27 4.28 2.26 20.0 120 \n", + "176 3 14.13 4.10 2.74 24.5 96 \n", + "\n", + " Flavanoids Nonflavanoid phenols Proanthocyanins Color intensity \\\n", + "0 2.65 2.76 0.26 1.28 \n", + "2 3.85 3.49 0.24 2.18 \n", + "4 3.27 3.39 0.34 1.97 \n", + "6 2.60 2.51 0.31 1.25 \n", + "8 2.98 3.15 0.22 1.85 \n", + "10 2.20 2.43 0.26 1.57 \n", + "12 3.10 3.69 0.43 2.81 \n", + "14 2.85 2.91 0.30 1.46 \n", + "16 2.95 3.40 0.40 1.72 \n", + "18 2.70 3.03 0.17 1.66 \n", + "20 2.41 2.41 0.25 1.98 \n", + "22 2.48 2.37 0.26 1.46 \n", + "24 2.63 2.68 0.47 1.92 \n", + "26 2.40 2.19 0.27 1.35 \n", + "28 2.65 2.33 0.26 1.98 \n", + "30 2.86 3.19 0.22 1.95 \n", + "32 2.95 2.74 0.50 1.35 \n", + "34 2.70 2.98 0.26 1.86 \n", + "36 2.45 2.43 0.29 1.44 \n", + "38 3.00 3.04 0.20 2.08 \n", + "40 2.45 2.68 0.27 1.48 \n", + "42 2.64 2.63 0.32 1.66 \n", + "44 2.85 2.65 0.30 1.25 \n", + "46 3.10 3.39 0.21 2.14 \n", + "48 2.88 3.54 0.32 2.08 \n", + "50 2.45 2.99 0.22 2.29 \n", + "52 3.00 2.79 0.39 1.68 \n", + "54 2.96 2.78 0.20 2.45 \n", + "56 3.00 3.23 0.31 1.66 \n", + "58 1.98 0.57 0.28 0.42 \n", + ".. ... ... ... ... \n", + "118 2.00 1.64 0.37 1.87 \n", + "120 3.18 5.08 0.47 1.87 \n", + "122 2.62 2.65 0.30 2.01 \n", + "124 2.60 2.65 0.37 1.35 \n", + "126 2.13 2.24 0.58 1.76 \n", + "128 2.10 1.75 0.42 1.35 \n", + "130 1.30 1.22 0.24 0.83 \n", + "132 1.70 1.20 0.17 0.84 \n", + "134 1.62 0.66 0.63 0.94 \n", + "136 1.79 0.60 0.63 1.10 \n", + "138 2.32 0.60 0.53 0.81 \n", + "140 1.40 0.50 0.37 0.64 \n", + "142 2.00 0.80 0.47 1.02 \n", + "144 1.50 0.55 0.43 1.30 \n", + "146 1.70 0.65 0.47 0.86 \n", + "148 1.41 1.39 0.34 1.14 \n", + "150 1.48 1.36 0.24 1.26 \n", + "152 1.80 0.83 0.61 1.87 \n", + "154 1.74 0.63 0.61 1.55 \n", + "156 1.90 0.58 0.63 1.14 \n", + "158 2.60 1.10 0.52 2.29 \n", + "160 1.83 0.56 0.50 0.80 \n", + "162 1.39 0.70 0.40 0.94 \n", + "164 1.28 0.47 0.52 1.15 \n", + "166 1.48 0.66 0.40 0.97 \n", + "168 1.98 0.96 0.27 1.11 \n", + "170 1.39 0.51 0.48 0.64 \n", + "172 1.68 0.61 0.52 1.06 \n", + "174 1.59 0.69 0.43 1.35 \n", + "176 2.05 0.76 0.56 1.35 \n", + "\n", + " Hue OD280/OD315 of diluted wines Proline calcium \n", + "0 4.380000 1.05 3.40 1050 \n", + "2 7.800000 0.86 3.45 1480 \n", + "4 6.750000 1.05 2.85 1450 \n", + "6 5.050000 1.06 3.58 1295 \n", + "8 7.220000 1.01 3.55 1045 \n", + "10 5.000000 1.17 2.82 1280 \n", + "12 5.400000 1.25 2.73 1150 \n", + "14 7.300000 1.28 2.88 1310 \n", + "16 6.600000 1.13 2.57 1130 \n", + "18 5.100000 0.96 3.36 845 \n", + "20 4.500000 1.03 3.52 770 \n", + "22 3.930000 1.09 3.63 1015 \n", + "24 3.580000 1.13 3.20 830 \n", + "26 3.950000 1.02 2.77 1285 \n", + "28 4.700000 1.04 3.59 1035 \n", + "30 6.900000 1.09 2.88 1515 \n", + "32 5.400000 1.25 3.00 1235 \n", + "34 5.100000 1.04 3.47 920 \n", + "36 4.250000 1.12 2.51 1105 \n", + "38 5.100000 0.89 3.53 760 \n", + "40 4.280000 0.91 3.00 1035 \n", + "42 4.360000 0.82 3.00 680 \n", + "44 5.240000 0.87 3.33 1080 \n", + "46 6.100000 0.91 3.33 985 \n", + "48 8.900000 1.12 3.10 1260 \n", + "50 5.600000 1.24 3.37 1265 \n", + "52 6.300000 1.13 2.93 1375 \n", + "54 6.250000 0.98 3.03 1120 \n", + "56 6.000000 1.07 2.84 1270 \n", + "58 1.950000 1.05 1.82 520 \n", + ".. ... ... ... ... \n", + "118 1.280000 0.93 3.05 564 \n", + "120 6.000000 0.93 3.69 465 \n", + "122 2.600000 0.73 3.10 380 \n", + "124 2.760000 0.86 3.28 378 \n", + "126 3.000000 0.97 2.44 466 \n", + "128 2.600000 0.79 2.57 580 \n", + "130 5.400000 0.74 1.42 530 \n", + "132 5.000000 0.78 1.29 600 \n", + "134 7.100000 0.73 1.58 695 \n", + "136 5.000000 0.82 1.69 515 \n", + "138 4.920000 0.89 2.15 590 \n", + "140 5.600000 0.70 2.47 780 \n", + "142 4.400000 0.91 2.05 550 \n", + "144 4.000000 0.60 1.68 830 \n", + "146 7.650000 0.54 1.86 625 \n", + "148 9.400000 0.57 1.33 550 \n", + "150 10.800000 0.48 1.47 480 \n", + "152 10.520000 0.56 1.51 675 \n", + "154 7.900000 0.60 1.48 725 \n", + "156 7.500000 0.67 1.73 880 \n", + "158 11.750000 0.57 1.78 620 \n", + "160 5.880000 0.96 1.82 680 \n", + "162 5.280000 0.68 1.75 675 \n", + "164 6.620000 0.78 1.75 520 \n", + "166 10.260000 0.72 1.75 685 \n", + "168 8.500000 0.67 1.92 630 \n", + "170 9.899999 0.57 1.63 470 \n", + "172 7.700000 0.64 1.74 740 \n", + "174 10.200000 0.59 1.56 835 \n", + "176 9.200000 0.61 1.60 560 \n", + "\n", + "[89 rows x 14 columns]\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "ILj255vpMlEo", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 3310 + }, + "outputId": "81f2f30e-addf-4310-a8be-b152ad02060f" + }, + "cell_type": "code", + "source": [ + "wine_df_copy.iloc[:3,0:1] = np.nan\n", + "print(wine_df_copy)" + ], + "execution_count": 61, + "outputs": [ + { + "output_type": "stream", + "text": [ + " Alcohol Malic acid Ash Alcalinity of ash Magnesium Total phenols \\\n", + "0 NaN 13.20 1.78 2.14 11.2 100 \n", + "2 NaN 14.37 1.95 2.50 16.8 113 \n", + "4 NaN 14.20 1.76 2.45 15.2 112 \n", + "6 1.0 14.06 2.15 2.61 17.6 121 \n", + "8 1.0 13.86 1.35 2.27 16.0 98 \n", + "10 1.0 14.12 1.48 2.32 16.8 95 \n", + "12 1.0 14.75 1.73 2.39 11.4 91 \n", + "14 1.0 13.63 1.81 2.70 17.2 112 \n", + "16 1.0 13.83 1.57 2.62 20.0 115 \n", + "18 1.0 13.64 3.10 2.56 15.2 116 \n", + "20 1.0 12.93 3.80 2.65 18.6 102 \n", + "22 1.0 12.85 1.60 2.52 17.8 95 \n", + "24 1.0 13.05 2.05 3.22 25.0 124 \n", + "26 1.0 13.30 1.72 2.14 17.0 94 \n", + "28 1.0 14.02 1.68 2.21 16.0 96 \n", + "30 1.0 13.58 1.66 2.36 19.1 106 \n", + "32 1.0 13.76 1.53 2.70 19.5 132 \n", + "34 1.0 13.48 1.81 2.41 20.5 100 \n", + "36 1.0 13.05 1.65 2.55 18.0 98 \n", + "38 1.0 14.22 3.99 2.51 13.2 128 \n", + "40 1.0 13.41 3.84 2.12 18.8 90 \n", + "42 1.0 13.24 3.98 2.29 17.5 103 \n", + "44 1.0 14.21 4.04 2.44 18.9 111 \n", + "46 1.0 13.90 1.68 2.12 16.0 101 \n", + "48 1.0 13.94 1.73 2.27 17.4 108 \n", + "50 1.0 13.83 1.65 2.60 17.2 94 \n", + "52 1.0 13.77 1.90 2.68 17.1 115 \n", + "54 1.0 13.56 1.73 2.46 20.5 116 \n", + "56 1.0 13.29 1.97 2.68 16.8 102 \n", + "58 2.0 12.37 0.94 1.36 10.6 88 \n", + ".. ... ... ... ... ... ... \n", + "118 2.0 12.00 3.43 2.00 19.0 87 \n", + "120 2.0 11.56 2.05 3.23 28.5 119 \n", + "122 2.0 13.05 5.80 2.13 21.5 86 \n", + "124 2.0 12.07 2.16 2.17 21.0 85 \n", + "126 2.0 11.79 2.13 2.78 28.5 92 \n", + "128 2.0 12.04 4.30 2.38 22.0 80 \n", + "130 3.0 12.88 2.99 2.40 20.0 104 \n", + "132 3.0 12.70 3.55 2.36 21.5 106 \n", + "134 3.0 12.60 2.46 2.20 18.5 94 \n", + "136 3.0 12.53 5.51 2.64 25.0 96 \n", + "138 3.0 12.84 2.96 2.61 24.0 101 \n", + "140 3.0 13.36 2.56 2.35 20.0 89 \n", + "142 3.0 13.62 4.95 2.35 20.0 92 \n", + "144 3.0 13.16 3.57 2.15 21.0 102 \n", + "146 3.0 12.87 4.61 2.48 21.5 86 \n", + "148 3.0 13.08 3.90 2.36 21.5 113 \n", + "150 3.0 12.79 2.67 2.48 22.0 112 \n", + "152 3.0 13.23 3.30 2.28 18.5 98 \n", + "154 3.0 13.17 5.19 2.32 22.0 93 \n", + "156 3.0 12.45 3.03 2.64 27.0 97 \n", + "158 3.0 13.48 1.67 2.64 22.5 89 \n", + "160 3.0 13.69 3.26 2.54 20.0 107 \n", + "162 3.0 12.96 3.45 2.35 18.5 106 \n", + "164 3.0 13.73 4.36 2.26 22.5 88 \n", + "166 3.0 12.82 3.37 2.30 19.5 88 \n", + "168 3.0 13.40 4.60 2.86 25.0 112 \n", + "170 3.0 12.77 2.39 2.28 19.5 86 \n", + "172 3.0 13.71 5.65 2.45 20.5 95 \n", + "174 3.0 13.27 4.28 2.26 20.0 120 \n", + "176 3.0 14.13 4.10 2.74 24.5 96 \n", + "\n", + " Flavanoids Nonflavanoid phenols Proanthocyanins Color intensity \\\n", + "0 2.65 2.76 0.26 1.28 \n", + "2 3.85 3.49 0.24 2.18 \n", + "4 3.27 3.39 0.34 1.97 \n", + "6 2.60 2.51 0.31 1.25 \n", + "8 2.98 3.15 0.22 1.85 \n", + "10 2.20 2.43 0.26 1.57 \n", + "12 3.10 3.69 0.43 2.81 \n", + "14 2.85 2.91 0.30 1.46 \n", + "16 2.95 3.40 0.40 1.72 \n", + "18 2.70 3.03 0.17 1.66 \n", + "20 2.41 2.41 0.25 1.98 \n", + "22 2.48 2.37 0.26 1.46 \n", + "24 2.63 2.68 0.47 1.92 \n", + "26 2.40 2.19 0.27 1.35 \n", + "28 2.65 2.33 0.26 1.98 \n", + "30 2.86 3.19 0.22 1.95 \n", + "32 2.95 2.74 0.50 1.35 \n", + "34 2.70 2.98 0.26 1.86 \n", + "36 2.45 2.43 0.29 1.44 \n", + "38 3.00 3.04 0.20 2.08 \n", + "40 2.45 2.68 0.27 1.48 \n", + "42 2.64 2.63 0.32 1.66 \n", + "44 2.85 2.65 0.30 1.25 \n", + "46 3.10 3.39 0.21 2.14 \n", + "48 2.88 3.54 0.32 2.08 \n", + "50 2.45 2.99 0.22 2.29 \n", + "52 3.00 2.79 0.39 1.68 \n", + "54 2.96 2.78 0.20 2.45 \n", + "56 3.00 3.23 0.31 1.66 \n", + "58 1.98 0.57 0.28 0.42 \n", + ".. ... ... ... ... \n", + "118 2.00 1.64 0.37 1.87 \n", + "120 3.18 5.08 0.47 1.87 \n", + "122 2.62 2.65 0.30 2.01 \n", + "124 2.60 2.65 0.37 1.35 \n", + "126 2.13 2.24 0.58 1.76 \n", + "128 2.10 1.75 0.42 1.35 \n", + "130 1.30 1.22 0.24 0.83 \n", + "132 1.70 1.20 0.17 0.84 \n", + "134 1.62 0.66 0.63 0.94 \n", + "136 1.79 0.60 0.63 1.10 \n", + "138 2.32 0.60 0.53 0.81 \n", + "140 1.40 0.50 0.37 0.64 \n", + "142 2.00 0.80 0.47 1.02 \n", + "144 1.50 0.55 0.43 1.30 \n", + "146 1.70 0.65 0.47 0.86 \n", + "148 1.41 1.39 0.34 1.14 \n", + "150 1.48 1.36 0.24 1.26 \n", + "152 1.80 0.83 0.61 1.87 \n", + "154 1.74 0.63 0.61 1.55 \n", + "156 1.90 0.58 0.63 1.14 \n", + "158 2.60 1.10 0.52 2.29 \n", + "160 1.83 0.56 0.50 0.80 \n", + "162 1.39 0.70 0.40 0.94 \n", + "164 1.28 0.47 0.52 1.15 \n", + "166 1.48 0.66 0.40 0.97 \n", + "168 1.98 0.96 0.27 1.11 \n", + "170 1.39 0.51 0.48 0.64 \n", + "172 1.68 0.61 0.52 1.06 \n", + "174 1.59 0.69 0.43 1.35 \n", + "176 2.05 0.76 0.56 1.35 \n", + "\n", + " Hue OD280/OD315 of diluted wines Proline calcium \n", + "0 4.380000 1.05 3.40 1050 \n", + "2 7.800000 0.86 3.45 1480 \n", + "4 6.750000 1.05 2.85 1450 \n", + "6 5.050000 1.06 3.58 1295 \n", + "8 7.220000 1.01 3.55 1045 \n", + "10 5.000000 1.17 2.82 1280 \n", + "12 5.400000 1.25 2.73 1150 \n", + "14 7.300000 1.28 2.88 1310 \n", + "16 6.600000 1.13 2.57 1130 \n", + "18 5.100000 0.96 3.36 845 \n", + "20 4.500000 1.03 3.52 770 \n", + "22 3.930000 1.09 3.63 1015 \n", + "24 3.580000 1.13 3.20 830 \n", + "26 3.950000 1.02 2.77 1285 \n", + "28 4.700000 1.04 3.59 1035 \n", + "30 6.900000 1.09 2.88 1515 \n", + "32 5.400000 1.25 3.00 1235 \n", + "34 5.100000 1.04 3.47 920 \n", + "36 4.250000 1.12 2.51 1105 \n", + "38 5.100000 0.89 3.53 760 \n", + "40 4.280000 0.91 3.00 1035 \n", + "42 4.360000 0.82 3.00 680 \n", + "44 5.240000 0.87 3.33 1080 \n", + "46 6.100000 0.91 3.33 985 \n", + "48 8.900000 1.12 3.10 1260 \n", + "50 5.600000 1.24 3.37 1265 \n", + "52 6.300000 1.13 2.93 1375 \n", + "54 6.250000 0.98 3.03 1120 \n", + "56 6.000000 1.07 2.84 1270 \n", + "58 1.950000 1.05 1.82 520 \n", + ".. ... ... ... ... \n", + "118 1.280000 0.93 3.05 564 \n", + "120 6.000000 0.93 3.69 465 \n", + "122 2.600000 0.73 3.10 380 \n", + "124 2.760000 0.86 3.28 378 \n", + "126 3.000000 0.97 2.44 466 \n", + "128 2.600000 0.79 2.57 580 \n", + "130 5.400000 0.74 1.42 530 \n", + "132 5.000000 0.78 1.29 600 \n", + "134 7.100000 0.73 1.58 695 \n", + "136 5.000000 0.82 1.69 515 \n", + "138 4.920000 0.89 2.15 590 \n", + "140 5.600000 0.70 2.47 780 \n", + "142 4.400000 0.91 2.05 550 \n", + "144 4.000000 0.60 1.68 830 \n", + "146 7.650000 0.54 1.86 625 \n", + "148 9.400000 0.57 1.33 550 \n", + "150 10.800000 0.48 1.47 480 \n", + "152 10.520000 0.56 1.51 675 \n", + "154 7.900000 0.60 1.48 725 \n", + "156 7.500000 0.67 1.73 880 \n", + "158 11.750000 0.57 1.78 620 \n", + "160 5.880000 0.96 1.82 680 \n", + "162 5.280000 0.68 1.75 675 \n", + "164 6.620000 0.78 1.75 520 \n", + "166 10.260000 0.72 1.75 685 \n", + "168 8.500000 0.67 1.92 630 \n", + "170 9.899999 0.57 1.63 470 \n", + "172 7.700000 0.64 1.74 740 \n", + "174 10.200000 0.59 1.56 835 \n", + "176 9.200000 0.61 1.60 560 \n", + "\n", + "[89 rows x 14 columns]\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "yBfgX6ytM3rZ", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "random = np.random.randint(1,11,10)" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "at3gq_2LNDs5", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 89 + }, + "outputId": "aa8318d3-cbf4-459c-a750-5a71596c2ff4" + }, + "cell_type": "code", + "source": [ + "wine_df_copy.iloc[:,0:1] = np.nan\n", + "\n", + "wine_df_copy.isnull().sum()\n", + "wine_df_copy= wine_df_copy.dropna(how = 'any',axis = 0)\n", + "print(wine_df_copy)\n", + " " + ], + "execution_count": 65, + "outputs": [ + { + "output_type": "stream", + "text": [ + "Empty DataFrame\n", + "Columns: [Alcohol, Malic acid, Ash, Alcalinity of ash, Magnesium, Total phenols, Flavanoids, Nonflavanoid phenols, Proanthocyanins, Color intensity, Hue, OD280/OD315 of diluted wines, Proline, calcium]\n", + "Index: []\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "FWwjUE-mNgQr", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "" + ], + "execution_count": 0, + "outputs": [] + } + ] +} \ No newline at end of file