{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "The autoreload instruction reloads modules automatically before code execution, which is helpful for the update below." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Make sure that we have the latest version of pandas-profiling." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import sys\n", "\n", "!\"{sys.executable}\" -m pip install -U pandas-profiling[notebook]\n", "!jupyter nbextension enable --py widgetsnbextension" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You might want to restart the kernel now." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Standard Library Imports\n", "from pathlib import Path\n", "\n", "# Installed packages\n", "import pandas as pd\n", "from ipywidgets import widgets\n", "\n", "# Our package\n", "from ydata_profiling import ProfileReport\n", "from ydata_profiling.utils.cache import cache_file" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Read the Titanic Dataset\n", "file_name = cache_file(\n", " \"titanic.csv\",\n", " \"https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv\",\n", ")\n", "df = pd.read_csv(file_name)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Generate the Profiling Report\n", "profile = ProfileReport(\n", " df, title=\"Titanic Dataset\", html={\"style\": {\"full_width\": True}}, sort=None\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# The Notebook Widgets Interface\n", "profile.to_widgets()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Or use the HTML report in an iframe\n", "profile" ] } ], "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.7.3" } }, "nbformat": 4, "nbformat_minor": 4 }