Format: application/octet-stream
⬇ Download File (10.5 KB)
   1  {
   2   "cells": [
   3    {
   4     "cell_type": "code",
   5     "execution_count": 1,
   6     "id": "cd75b6ac",
   7     "metadata": {},
   8     "outputs": [],
   9     "source": [
  10      "import pandas as pd\n",
  11      "import matplotlib.pyplot as plt\n"
  12     ]
  13    },
  14    {
  15     "cell_type": "code",
  16     "execution_count": 2,
  17     "id": "aa90abb9",
  18     "metadata": {},
  19     "outputs": [],
  20     "source": [
  21      "al= pd.read_csv('alloted.csv')\n",
  22      "paid= pd.read_csv('paid.csv')"
  23     ]
  24    },
  25    {
  26     "cell_type": "code",
  27     "execution_count": 23,
  28     "id": "cffb9f9e",
  29     "metadata": {},
  30     "outputs": [],
  31     "source": [
  32      "a=pd.DataFrame(al.groupby('Product').sum().iloc[:,-1].sort_values(ascending=False).astype(int))\n",
  33      "b= pd.DataFrame(al.groupby('Product').count().iloc[:,-1].sort_values(ascending=False).astype(int))\n",
  34      "a=pd.merge(a,b, left_index=True, right_index=True)\n",
  35      "a.to_csv('F.csv')"
  36     ]
  37    },
  38    {
  39     "cell_type": "code",
  40     "execution_count": 17,
  41     "id": "ac6d9933",
  42     "metadata": {},
  43     "outputs": [
  44      {
  45       "data": {
  46        "text/plain": [
  47         "Product\n",
  48         "CA    465497605\n",
  49         "TW    222507193\n",
  50         "UT     36260589\n",
  51         "CD     11344560\n",
  52         "CT      3125076\n",
  53         "TT       290151\n",
  54         "CP        26382\n",
  55         "Name: TOTAL OD ( OD + CHARGES ), dtype: int32"
  56        ]
  57       },
  58       "execution_count": 17,
  59       "metadata": {},
  60       "output_type": "execute_result"
  61      }
  62     ],
  63     "source": [
  64      "al.groupby('Product').sum().iloc[:,-1].sort_values(ascending=False).astype(int)"
  65     ]
  66    },
  67    {
  68     "cell_type": "code",
  69     "execution_count": null,
  70     "id": "0d24669f",
  71     "metadata": {},
  72     "outputs": [],
  73     "source": []
  74    },
  75    {
  76     "cell_type": "code",
  77     "execution_count": 4,
  78     "id": "d4cfb8ff",
  79     "metadata": {},
  80     "outputs": [
  81      {
  82       "data": {
  83        "text/html": [
  84         "<div>\n",
  85         "<style scoped>\n",
  86         "    .dataframe tbody tr th:only-of-type {\n",
  87         "        vertical-align: middle;\n",
  88         "    }\n",
  89         "\n",
  90         "    .dataframe tbody tr th {\n",
  91         "        vertical-align: top;\n",
  92         "    }\n",
  93         "\n",
  94         "    .dataframe thead th {\n",
  95         "        text-align: right;\n",
  96         "    }\n",
  97         "</style>\n",
  98         "<table border=\"1\" class=\"dataframe\">\n",
  99         "  <thead>\n",
 100         "    <tr style=\"text-align: right;\">\n",
 101         "      <th></th>\n",
 102         "      <th>AMOUNT COLLECTED</th>\n",
 103         "    </tr>\n",
 104         "  </thead>\n",
 105         "  <tbody>\n",
 106         "    <tr>\n",
 107         "      <th>0</th>\n",
 108         "      <td>2577.0</td>\n",
 109         "    </tr>\n",
 110         "    <tr>\n",
 111         "      <th>1</th>\n",
 112         "      <td>2165.0</td>\n",
 113         "    </tr>\n",
 114         "    <tr>\n",
 115         "      <th>2</th>\n",
 116         "      <td>5000.0</td>\n",
 117         "    </tr>\n",
 118         "    <tr>\n",
 119         "      <th>3</th>\n",
 120         "      <td>1825.0</td>\n",
 121         "    </tr>\n",
 122         "    <tr>\n",
 123         "      <th>4</th>\n",
 124         "      <td>2300.0</td>\n",
 125         "    </tr>\n",
 126         "    <tr>\n",
 127         "      <th>...</th>\n",
 128         "      <td>...</td>\n",
 129         "    </tr>\n",
 130         "    <tr>\n",
 131         "      <th>3661</th>\n",
 132         "      <td>2450.0</td>\n",
 133         "    </tr>\n",
 134         "    <tr>\n",
 135         "      <th>3662</th>\n",
 136         "      <td>150000.0</td>\n",
 137         "    </tr>\n",
 138         "    <tr>\n",
 139         "      <th>3663</th>\n",
 140         "      <td>3415.0</td>\n",
 141         "    </tr>\n",
 142         "    <tr>\n",
 143         "      <th>3664</th>\n",
 144         "      <td>4500.0</td>\n",
 145         "    </tr>\n",
 146         "    <tr>\n",
 147         "      <th>3665</th>\n",
 148         "      <td>3555.0</td>\n",
 149         "    </tr>\n",
 150         "  </tbody>\n",
 151         "</table>\n",
 152         "<p>3666 rows × 1 columns</p>\n",
 153         "</div>"
 154        ],
 155        "text/plain": [
 156         "      AMOUNT COLLECTED\n",
 157         "0               2577.0\n",
 158         "1               2165.0\n",
 159         "2               5000.0\n",
 160         "3               1825.0\n",
 161         "4               2300.0\n",
 162         "...                ...\n",
 163         "3661            2450.0\n",
 164         "3662          150000.0\n",
 165         "3663            3415.0\n",
 166         "3664            4500.0\n",
 167         "3665            3555.0\n",
 168         "\n",
 169         "[3666 rows x 1 columns]"
 170        ]
 171       },
 172       "execution_count": 4,
 173       "metadata": {},
 174       "output_type": "execute_result"
 175      }
 176     ],
 177     "source": [
 178      "paid"
 179     ]
 180    },
 181    {
 182     "cell_type": "code",
 183     "execution_count": 27,
 184     "id": "9b7ac5af",
 185     "metadata": {},
 186     "outputs": [
 187      {
 188       "ename": "ValueError",
 189       "evalue": "No objects to concatenate",
 190       "output_type": "error",
 191       "traceback": [
 192        "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
 193        "\u001b[1;31mValueError\u001b[0m                                Traceback (most recent call last)",
 194        "\u001b[1;32m<ipython-input-27-daf84f6405d6>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mpaid\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdescribe\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0minclude\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'object'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
 195        "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\generic.py\u001b[0m in \u001b[0;36mdescribe\u001b[1;34m(self, percentiles, include, exclude, datetime_is_numeric)\u001b[0m\n\u001b[0;32m  10408\u001b[0m                     \u001b[0mnames\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m  10409\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m> 10410\u001b[1;33m         \u001b[0md\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mconcat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mreindex\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnames\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mFalse\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mx\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mldesc\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msort\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mFalse\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m  10411\u001b[0m         \u001b[0md\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcolumns\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdata\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcopy\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m  10412\u001b[0m         \u001b[1;32mreturn\u001b[0m \u001b[0md\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
 196        "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\reshape\\concat.py\u001b[0m in \u001b[0;36mconcat\u001b[1;34m(objs, axis, join, ignore_index, keys, levels, names, verify_integrity, sort, copy)\u001b[0m\n\u001b[0;32m    283\u001b[0m     \u001b[0mValueError\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mIndexes\u001b[0m \u001b[0mhave\u001b[0m \u001b[0moverlapping\u001b[0m \u001b[0mvalues\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;34m'a'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    284\u001b[0m     \"\"\"\n\u001b[1;32m--> 285\u001b[1;33m     op = _Concatenator(\n\u001b[0m\u001b[0;32m    286\u001b[0m         \u001b[0mobjs\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    287\u001b[0m         \u001b[0maxis\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0maxis\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
 197        "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\reshape\\concat.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, objs, axis, join, keys, levels, names, ignore_index, verify_integrity, copy, sort)\u001b[0m\n\u001b[0;32m    340\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    341\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mobjs\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 342\u001b[1;33m             \u001b[1;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"No objects to concatenate\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    343\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    344\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mkeys\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
 198        "\u001b[1;31mValueError\u001b[0m: No objects to concatenate"
 199       ]
 200      }
 201     ],
 202     "source": [
 203      "paid.describe(include=['object'])\n"
 204     ]
 205    },
 206    {
 207     "cell_type": "code",
 208     "execution_count": 28,
 209     "id": "2b4088fe",
 210     "metadata": {},
 211     "outputs": [
 212      {
 213       "data": {
 214        "text/plain": [
 215         "0.19757477768795473"
 216        ]
 217       },
 218       "execution_count": 28,
 219       "metadata": {},
 220       "output_type": "execute_result"
 221      }
 222     ],
 223     "source": [
 224      "len(paid)/len(al)"
 225     ]
 226    },
 227    {
 228     "cell_type": "code",
 229     "execution_count": 1,
 230     "id": "61f6bf30",
 231     "metadata": {},
 232     "outputs": [],
 233     "source": [
 234      "a=[1,5,4]"
 235     ]
 236    },
 237    {
 238     "cell_type": "code",
 239     "execution_count": 3,
 240     "id": "0dbce46f",
 241     "metadata": {},
 242     "outputs": [],
 243     "source": [
 244      "a.sort()"
 245     ]
 246    },
 247    {
 248     "cell_type": "code",
 249     "execution_count": 4,
 250     "id": "b90271b2",
 251     "metadata": {},
 252     "outputs": [
 253      {
 254       "data": {
 255        "text/plain": [
 256         "[1, 4, 5]"
 257        ]
 258       },
 259       "execution_count": 4,
 260       "metadata": {},
 261       "output_type": "execute_result"
 262      }
 263     ],
 264     "source": [
 265      "a"
 266     ]
 267    },
 268    {
 269     "cell_type": "code",
 270     "execution_count": null,
 271     "id": "0c785427",
 272     "metadata": {},
 273     "outputs": [],
 274     "source": []
 275    }
 276   ],
 277   "metadata": {
 278    "kernelspec": {
 279     "display_name": "Python 3",
 280     "language": "python",
 281     "name": "python3"
 282    },
 283    "language_info": {
 284     "codemirror_mode": {
 285      "name": "ipython",
 286      "version": 3
 287     },
 288     "file_extension": ".py",
 289     "mimetype": "text/x-python",
 290     "name": "python",
 291     "nbconvert_exporter": "python",
 292     "pygments_lexer": "ipython3",
 293     "version": "3.8.8"
 294    }
 295   },
 296   "nbformat": 4,
 297   "nbformat_minor": 5
 298  }
 299