Skip to content

Instantly share code, notes, and snippets.

@sharmasha2nk
Created June 5, 2020 10:48
Show Gist options
  • Save sharmasha2nk/32b7c678db347a396286e2460cfcf011 to your computer and use it in GitHub Desktop.
Save sharmasha2nk/32b7c678db347a396286e2460cfcf011 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": " id name cuteness\ntown \nbangalore 8 tiger 8\ndelhi 5 tom 10\nmeerut 6 meowses 9\nmumbai 10 meowses 9",
"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>id</th>\n <th>name</th>\n <th>cuteness</th>\n </tr>\n <tr>\n <th>town</th>\n <th></th>\n <th></th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>bangalore</th>\n <td>8</td>\n <td>tiger</td>\n <td>8</td>\n </tr>\n <tr>\n <th>delhi</th>\n <td>5</td>\n <td>tom</td>\n <td>10</td>\n </tr>\n <tr>\n <th>meerut</th>\n <td>6</td>\n <td>meowses</td>\n <td>9</td>\n </tr>\n <tr>\n <th>mumbai</th>\n <td>10</td>\n <td>meowses</td>\n <td>9</td>\n </tr>\n </tbody>\n</table>\n</div>"
},
"metadata": {},
"execution_count": 8
}
],
"source": [
"df.groupby(['town']).max()"
]
}
],
"metadata": {
"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.7.6-final"
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment