{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "3f9478a2",
   "metadata": {},
   "outputs": [],
   "source": [
    "l= [x for x in range(1,10001) if x%7==0 and x%13==0 and x%17==0]\n",
    "d= dict(zip(range(1,len(l)+1),  l))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "705698d8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{1: 1547, 2: 3094, 3: 4641, 4: 6188, 5: 7735, 6: 9282}"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "4f207803",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1547"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "4c65152d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1547"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d.pop(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "aad60de3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(6, 9282)"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d.popitem()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "5d252eee",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_values([3094, 4641, 6188, 7735])"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d.values()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "6d6b917f",
   "metadata": {},
   "outputs": [],
   "source": [
    "s= 'hi hhow are you'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "f64654dc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Hi Hhow Are You'"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.title()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "707b10fb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(s.split(' '))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "4f9621b5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "15"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(s)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "08a23ac4",
   "metadata": {},
   "outputs": [],
   "source": [
    "l=list(s)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "6e659aec",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['h', 'i', ' ', 'h', 'h', 'o', 'w', ' ', 'a', 'r', 'e', ' ', 'y', 'o', 'u']"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "l"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "823ad731",
   "metadata": {},
   "outputs": [],
   "source": [
    "d = {\n",
    "  \"name\": \"Dog\",\n",
    "  \"age\":5,\n",
    "  \"Weight\": 4,\n",
    "  \"Country\": \"US\",\n",
    "  \"City\":\"California\"\n",
    "   \n",
    "}\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "0ae9c1d3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'name': 'Dog', 'age': 5}"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dict(zip(['name', 'age'], [d['name'], d['age']]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "c49970f2",
   "metadata": {},
   "outputs": [],
   "source": [
    "del d['name'], d['age']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a00ff2b9",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "id": "e672e044",
   "metadata": {},
   "outputs": [],
   "source": [
    "d= {'b':5,'a':1,'D':4}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "adc7b70f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4\n",
      "1\n",
      "5\n"
     ]
    }
   ],
   "source": [
    "for _ in sorted(d):\n",
    "    print(d[_])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "d39a70a6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2550608643392"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "id(d)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "3d559509",
   "metadata": {},
   "outputs": [],
   "source": [
    "d['animalname']= d.pop('name')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "6628f948",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'age': 5,\n",
       " 'Weight': 4,\n",
       " 'Country': 'US',\n",
       " 'City': 'California',\n",
       " 'animalname': 'Dog'}"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "id": "0f60311e",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "unhashable type: 'list'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-65-fa3104c36ec4>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0md\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'age'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'animalname'\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",
      "\u001b[1;31mTypeError\u001b[0m: unhashable type: 'list'"
     ]
    }
   ],
   "source": [
    "d[['age','animalname']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "id": "5214f1cd",
   "metadata": {},
   "outputs": [],
   "source": [
    "if 'age' in d:\n",
    "    del d['age']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "id": "4764dc47",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Weight': 4, 'Country': 'US', 'City': 'California', 'animalname': 'Dog'}"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "id": "d2d353a4",
   "metadata": {},
   "outputs": [],
   "source": [
    "d.get?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "id": "55cd11f0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'a'"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "min(d, key= d.get)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "id": "1794e90a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'b': 5, 'a': 1, 'D': 4}"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "id": "978b9baa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['b', 'D']"
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sorted(d, key= d.get,reverse=1)[:2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2c18c380",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "id": "30546ded",
   "metadata": {},
   "outputs": [],
   "source": [
    "d= {'Fr   uit':['Apple','Banana','Orange'],'Sub   ject':['Phy','Math','English']}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "id": "635fd51f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Fruit': ['Apple', 'Banana', 'Orange'], 'Subject': ['Phy', 'Math', 'English']}"
      ]
     },
     "execution_count": 96,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "{x.replace(' ',''):d[x] for x in d.keys()}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "id": "fde90bad",
   "metadata": {},
   "outputs": [],
   "source": [
    "d = {'lang': 'C#', 'Fruit': 'Apple', 'Subj':None,'Animal':None}\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "id": "0a63b8ef",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'lang': 'C#', 'Fruit': 'Apple'}"
      ]
     },
     "execution_count": 100,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "{i: j for i,j in d.items() if j != None}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "id": "eb8a70b7",
   "metadata": {},
   "outputs": [],
   "source": [
    "d={'Racx': 12000, 'Max':80000,'Stack':80000,'John':80000,}\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "id": "1e330628",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{12000: 1, 80000: 3}"
      ]
     },
     "execution_count": 104,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "{x : list(d.values()).count(x) for x in set(d.values())}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "049ccf87",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c879dd63",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "id": "4d8f5676",
   "metadata": {},
   "outputs": [],
   "source": [
    "s= 'hi how are you'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "id": "d8f99af6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'you are how hi'"
      ]
     },
     "execution_count": 109,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "' '.join(reversed(s.split(' ')))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 115,
   "id": "793155a1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['h', ' ', 'o', ' ', 'r', ' ', 'o']"
      ]
     },
     "execution_count": 115,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[s[i] for i in range(len(s)) if i%2==0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "id": "75a1a127",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 116,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.startswith('hi')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "id": "119dfc8c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 117,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.endswith('bye')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "id": "e2758806",
   "metadata": {},
   "outputs": [],
   "source": [
    "s= '\\nPython String\\n with\\n newline\\n'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "id": "24704d80",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Python String\n",
      " with\n",
      " newline\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(s)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "c2497629",
   "metadata": {},
   "outputs": [],
   "source": [
    "s1 = \"Let us Learn Python\"\n",
    "s2 = \"PythonProgram\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "05535293",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{' ', 'L', 'P', 'a', 'e', 'h', 'n', 'o', 'r', 's', 't', 'u', 'y'}"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "set(s1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "2f29243a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'leT uS learN pythoN'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "''.join(reversed(''.join(reversed(s1)).title()))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 134,
   "id": "736366dd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "9"
      ]
     },
     "execution_count": 134,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len([x for x in set(s1) if x in set(s2)])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 138,
   "id": "d6813d4e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Python', 'is', 'Amazing']"
      ]
     },
     "execution_count": 138,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1.split(' ')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "960c6527",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[False,\n",
       " True,\n",
       " True,\n",
       " False,\n",
       " True,\n",
       " True,\n",
       " False,\n",
       " False,\n",
       " True,\n",
       " True,\n",
       " True,\n",
       " True,\n",
       " False,\n",
       " False,\n",
       " True,\n",
       " True,\n",
       " True,\n",
       " True,\n",
       " True]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[x.islower() for x in list(s1)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "a70f7cd6",
   "metadata": {},
   "outputs": [],
   "source": [
    "l= sum([x.islower() for x in s1])\n",
    "u = sum([x.isupper() for x in list(s1)])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "fd60d4f9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "13"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "l"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "09eeaf1c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "da8ed039",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "11"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len([x for x in s1 if x  not in 'aeiouAEIOU ' ])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "201f0d10",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5c77a73f",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "a57c91c0",
   "metadata": {},
   "outputs": [],
   "source": [
    "l= [['tom',10], ['mary',12], ['k',13], ['bernard',9]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "47fc74a1",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "18c896c7",
   "metadata": {},
   "outputs": [],
   "source": [
    "df= pd.DataFrame(l, columns=['name', 'age'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "76ba22f1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Name</th>\n",
       "      <th>Age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>tom</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>mary</td>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>k</td>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>bernard</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      Name  Age\n",
       "0      tom   10\n",
       "1     mary   12\n",
       "2        k   13\n",
       "3  bernard    9"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.rename(columns={'name':'Name', 'age':'Age'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "25cf15ab",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>name</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>tom</th>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mary</th>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>k</th>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>bernard</th>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         age\n",
       "name        \n",
       "tom       10\n",
       "mary      12\n",
       "k         13\n",
       "bernard    9"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.set_index('name')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "d4e9e4f8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>k</td>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  name  age\n",
       "2    k   13"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[(df.age> df.age.mean()) & (df.name!='mary')]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "689a83f3",
   "metadata": {},
   "outputs": [],
   "source": [
    "s=[ ['tom', 500] , ['jack', 600], ['mary', 350], ['j',400] ]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "fee75e4e",
   "metadata": {},
   "outputs": [],
   "source": [
    "dfs= pd.DataFrame(s, columns= ['name', 'salary'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "c5cd443b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>salary</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>tom</td>\n",
       "      <td>500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>jack</td>\n",
       "      <td>600</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>mary</td>\n",
       "      <td>350</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>j</td>\n",
       "      <td>400</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   name  salary\n",
       "0   tom     500\n",
       "1  jack     600\n",
       "2  mary     350\n",
       "3     j     400"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dfs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "f618f508",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>salary</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>tom</td>\n",
       "      <td>10</td>\n",
       "      <td>500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>mary</td>\n",
       "      <td>12</td>\n",
       "      <td>350</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   name  age  salary\n",
       "0   tom   10     500\n",
       "1  mary   12     350"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.merge(dfs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "da8f6fb3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>salary</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>tom</td>\n",
       "      <td>10</td>\n",
       "      <td>500.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>mary</td>\n",
       "      <td>12</td>\n",
       "      <td>350.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>k</td>\n",
       "      <td>13</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>bernard</td>\n",
       "      <td>9</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      name  age  salary\n",
       "0      tom   10   500.0\n",
       "1     mary   12   350.0\n",
       "2        k   13     NaN\n",
       "3  bernard    9     NaN"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.merge(dfs, how='left')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "b71361ba",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>salary</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>tom</td>\n",
       "      <td>10.0</td>\n",
       "      <td>500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>jack</td>\n",
       "      <td>NaN</td>\n",
       "      <td>600</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>mary</td>\n",
       "      <td>12.0</td>\n",
       "      <td>350</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>j</td>\n",
       "      <td>NaN</td>\n",
       "      <td>400</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   name   age  salary\n",
       "0   tom  10.0     500\n",
       "1  jack   NaN     600\n",
       "2  mary  12.0     350\n",
       "3     j   NaN     400"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.merge(dfs, how='right')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "eb4c363d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>salary</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>tom</td>\n",
       "      <td>10.0</td>\n",
       "      <td>500.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>mary</td>\n",
       "      <td>12.0</td>\n",
       "      <td>350.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>k</td>\n",
       "      <td>13.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>bernard</td>\n",
       "      <td>9.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>jack</td>\n",
       "      <td>NaN</td>\n",
       "      <td>600.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>j</td>\n",
       "      <td>NaN</td>\n",
       "      <td>400.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      name   age  salary\n",
       "0      tom  10.0   500.0\n",
       "1     mary  12.0   350.0\n",
       "2        k  13.0     NaN\n",
       "3  bernard   9.0     NaN\n",
       "4     jack   NaN   600.0\n",
       "5        j   NaN   400.0"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.merge(dfs, how='outer')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "9a655eab",
   "metadata": {},
   "outputs": [],
   "source": [
    "df= df.merge(dfs, how='outer')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "ede21e4b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "name      0\n",
       "age       2\n",
       "salary    2\n",
       "dtype: int64"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.isna().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "9b50917d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>salary</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>tom</td>\n",
       "      <td>10.0</td>\n",
       "      <td>500.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>mary</td>\n",
       "      <td>12.0</td>\n",
       "      <td>350.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>k</td>\n",
       "      <td>13.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>bernard</td>\n",
       "      <td>9.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>jack</td>\n",
       "      <td>NaN</td>\n",
       "      <td>600.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>j</td>\n",
       "      <td>NaN</td>\n",
       "      <td>400.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      name   age  salary\n",
       "0      tom  10.0   500.0\n",
       "1     mary  12.0   350.0\n",
       "2        k  13.0     NaN\n",
       "3  bernard   9.0     NaN\n",
       "4     jack   NaN   600.0\n",
       "5        j   NaN   400.0"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "74c26fc9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>salary</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>tom</td>\n",
       "      <td>500.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>mary</td>\n",
       "      <td>350.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>k</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>bernard</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>jack</td>\n",
       "      <td>600.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>j</td>\n",
       "      <td>400.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      name  salary\n",
       "0      tom   500.0\n",
       "1     mary   350.0\n",
       "2        k     NaN\n",
       "3  bernard     NaN\n",
       "4     jack   600.0\n",
       "5        j   400.0"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.drop(columns=['age'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "ba1737bb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>salary</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>bernard</td>\n",
       "      <td>9.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>tom</td>\n",
       "      <td>10.0</td>\n",
       "      <td>500.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>mary</td>\n",
       "      <td>12.0</td>\n",
       "      <td>350.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>k</td>\n",
       "      <td>13.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>jack</td>\n",
       "      <td>NaN</td>\n",
       "      <td>600.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>j</td>\n",
       "      <td>NaN</td>\n",
       "      <td>400.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      name   age  salary\n",
       "3  bernard   9.0     NaN\n",
       "0      tom  10.0   500.0\n",
       "1     mary  12.0   350.0\n",
       "2        k  13.0     NaN\n",
       "4     jack   NaN   600.0\n",
       "5        j   NaN   400.0"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.sort_values(by='age')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "6b4f4d36",
   "metadata": {},
   "outputs": [],
   "source": [
    "df.fillna(df.mean(), inplace= True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "ccefc052",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>age</th>\n",
       "      <th>salary</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>name</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>bernard</th>\n",
       "      <td>9.0</td>\n",
       "      <td>462.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>j</th>\n",
       "      <td>11.0</td>\n",
       "      <td>400.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>jack</th>\n",
       "      <td>11.0</td>\n",
       "      <td>600.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>k</th>\n",
       "      <td>13.0</td>\n",
       "      <td>462.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mary</th>\n",
       "      <td>12.0</td>\n",
       "      <td>350.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>tom</th>\n",
       "      <td>10.0</td>\n",
       "      <td>500.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          age  salary\n",
       "name                 \n",
       "bernard   9.0   462.5\n",
       "j        11.0   400.0\n",
       "jack     11.0   600.0\n",
       "k        13.0   462.5\n",
       "mary     12.0   350.0\n",
       "tom      10.0   500.0"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.set_index('name').sort_index()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "3dc3e217",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>salary</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>mary</td>\n",
       "      <td>12.0</td>\n",
       "      <td>350.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   name   age  salary\n",
       "1  mary  12.0   350.0"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[(df.age>df.age.mean()) & (df.salary< df.salary.mean())]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f432d5ee",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
