Created
September 20, 2021 17:02
-
-
Save tonyfast/3e259e5033c7a284016cae9382d84415 to your computer and use it in GitHub Desktop.
pandas one liner demonstrating apply pandas Series patterns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"id": "4a4e4198-ac5a-41a6-9cd9-f35bc42112c1", | |
"metadata": {}, | |
"source": [ | |
"a one liner to demonstrate using `pandas.Series.apply` to widen dataframes with elements of containers." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 18, | |
"id": "1cf2472b-28ca-4976-9ed9-9796ceab6baa", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"<AxesSubplot:ylabel='language'>" | |
] | |
}, | |
"execution_count": 18, | |
"metadata": {}, | |
"output_type": "execute_result" | |
}, | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAATkAAADnCAYAAABloiEaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAh20lEQVR4nO3de3wcdb3/8dcnSZOmtE0otECBdiiUUihtuQoCpVrkiCsHVPhRbgIq/BAEDscDDgqHCIoLiMrFG9oCyk1REWVRQaC0pXLtLcUWEVjpjd5oU9qmzWU/54+Z2G2aezb73Z35PB+PfWR3dmbnkzZ55zsz3/l+RVUxxpioKnFdgDHG9CULOWNMpFnIGWMizULOGBNpFnLGmEizkDPGRJqFnDEm0izkjDGRZiFnjIk0CzljTKRZyBljIs1CzhgTaRZyxphIs5AzxkSahZwxJtIs5IwxkWYhZ4yJNAs5Y0ykWcgZYyLNQs4YE2kWcsaYSLOQM8ZEmoWcMSbSLOSMMZFmIWeMiTQLOWNMpFnIGWMircx1Aca05vmpEmAUMALYO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wX6tNlSC4GsLHVoL5EZa3eiwLv76VTiYa+vjbMY5ZyJmi5fmpcqA/wUi6DelkojdzmZqIspAzxkSajSdnjIk0CzljTKRZyBljIs1CzhgTaRZyxphIs5AzxkSahZwxJtIs5IwxkWYhZ4yJNAs5Y0ykWcgZYyLNQs4YE2kWcsaYSLOQM8ZEmoWcMSbSLOSMMZFmIWeMiTQLOWNMpFnIGWMizULOGBNpFnLGmEizkDPGRJqFnDEm0izkjDGRZiFnjIk0CzljTKRZyBljIu3/APkiHbqvojQNAAAAAElFTkSuQmCC\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
" import pandas\n", | |
"\n", | |
" pandas.read_json(\"https://api.github.com/users/tonyfast/gists\").set_index(\n", | |
" \"id\"\n", | |
" )[\"files\"].apply(\n", | |
" dict.values\n", | |
" ).apply(\n", | |
" list\n", | |
" ).apply(\n", | |
" pandas.Series # widen a dataframe by a list\n", | |
" ).stack(\n", | |
" ).apply(\n", | |
" pandas.Series # widen a dataframe by a dictionary\n", | |
" )[\"language\"].value_counts().plot.pie()" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3 (ipykernel)", | |
"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.9.5" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment