Re-factor code into function to print a column list

This commit is contained in:
Alexander Hess 2018-09-01 16:52:46 +02:00
commit 488fb69da9
2 changed files with 42 additions and 22 deletions

View file

@ -30,7 +30,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"2018-08-29 17:18:17 CEST\n",
"2018-09-01 16:51:42 CEST\n",
"\n",
"CPython 3.6.5\n",
"IPython 6.5.0\n",
@ -60,9 +60,7 @@
"source": [
"import missingno as msno\n",
"import numpy as np\n",
"import pandas as pd\n",
"\n",
"from tabulate import tabulate"
"import pandas as pd"
]
},
{
@ -96,6 +94,7 @@
" ORDINAL_COLUMNS,\n",
" ORDINAL_VARIABLES,\n",
" correct_column_names,\n",
" print_column_list,\n",
" update_column_descriptions,\n",
")"
]
@ -383,8 +382,7 @@
}
],
"source": [
"table = ((key, value[\"description\"]) for (key, value) in CONTINUOUS_COLUMNS.items())\n",
"print(tabulate(sorted(table), tablefmt=\"plain\"))"
"print_column_list(CONTINUOUS_COLUMNS)"
]
},
{
@ -749,8 +747,7 @@
}
],
"source": [
"table = ((key, value[\"description\"]) for (key, value) in DISCRETE_COLUMNS.items())\n",
"print(tabulate(sorted(table), tablefmt=\"plain\"))"
"print_column_list(DISCRETE_COLUMNS)"
]
},
{
@ -1081,8 +1078,7 @@
}
],
"source": [
"table = ((key, value[\"description\"]) for (key, value) in NOMINAL_COLUMNS.items())\n",
"print(tabulate(sorted(table), tablefmt=\"plain\"))"
"print_column_list(NOMINAL_COLUMNS)"
]
},
{
@ -1635,8 +1631,7 @@
}
],
"source": [
"table = ((key, value[\"description\"]) for (key, value) in ORDINAL_COLUMNS.items())\n",
"print(tabulate(sorted(table), tablefmt=\"plain\"))"
"print_column_list(ORDINAL_COLUMNS)"
]
},
{
@ -2146,7 +2141,9 @@
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
@ -2166,7 +2163,9 @@
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
@ -2186,7 +2185,9 @@
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
@ -2206,7 +2207,9 @@
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
@ -2262,8 +2265,7 @@
}
],
"source": [
"table = ((col, ALL_COLUMNS[col][\"description\"]) for col in sorted(missing_a_lot))\n",
"print(tabulate(table, tablefmt=\"plain\"))"
"print_column_list(missing_a_lot)"
]
},
{