{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "d5d0ea64", "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from IPython.core.display import display, HTML, Image\n", "display(HTML(\"\"))\n", "%config IPCompleter.use_jedi=False" ] }, { "cell_type": "code", "execution_count": 8, "id": "403c4b8a", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "from IPython.display import Markdown, display, HTML, IFrame\n", "from facets_overview.generic_feature_statistics_generator import GenericFeatureStatisticsGenerator\n", "import base64" ] }, { "cell_type": "code", "execution_count": 3, "id": "1c48706a", "metadata": {}, "outputs": [], "source": [ "df = pd.read_csv('./adult.csv')" ] }, { "cell_type": "code", "execution_count": 6, "id": "c000f04d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Private 22696\n", "Self-emp-not-inc 2541\n", "Local-gov 2093\n", "? 1836\n", "State-gov 1298\n", "Self-emp-inc 1116\n", "Federal-gov 960\n", "Without-pay 14\n", "Never-worked 7\n", "Name: workclass, dtype: int64" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df['workclass'].value_counts()" ] }, { "cell_type": "code", "execution_count": 10, "id": "85b71af5", "metadata": {}, "outputs": [], "source": [ "sprite_size = 32 if len(df.index)>50000 else 64\n", "\n", "jsonstr = df.to_json(orient='records') \n", "HTML_TEMPLATE = \"\"\"\n", " \n", " \n", " \n", " \"\"\"\n", "html = HTML_TEMPLATE.format(jsonstr=jsonstr, sprite_size=sprite_size)\n", "with open(\"index.html\",'w') as fo:\n", " fo.write(html)" ] }, { "cell_type": "code", "execution_count": null, "id": "fce8e9f4", "metadata": {}, "outputs": [], "source": [] } ], "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.7" } }, "nbformat": 4, "nbformat_minor": 5 }