|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": 10, |
| 6 | + "id": "fb120ffe", |
| 7 | + "metadata": {}, |
| 8 | + "outputs": [ |
| 9 | + { |
| 10 | + "data": { |
| 11 | + "text/plain": [ |
| 12 | + "'Using the Pandas Profiling module for profiling.'" |
| 13 | + ] |
| 14 | + }, |
| 15 | + "execution_count": 10, |
| 16 | + "metadata": {}, |
| 17 | + "output_type": "execute_result" |
| 18 | + } |
| 19 | + ], |
| 20 | + "source": [ |
| 21 | + "\"\"\"Using the Pandas Profiling module for profiling.\"\"\"" |
| 22 | + ] |
| 23 | + }, |
| 24 | + { |
| 25 | + "cell_type": "markdown", |
| 26 | + "id": "be1fe2b5", |
| 27 | + "metadata": {}, |
| 28 | + "source": [ |
| 29 | + "# Использование модуля Pandas Profiling для профилирования" |
| 30 | + ] |
| 31 | + }, |
| 32 | + { |
| 33 | + "cell_type": "markdown", |
| 34 | + "id": "1f624ec4", |
| 35 | + "metadata": {}, |
| 36 | + "source": [ |
| 37 | + "[`Pandas Profiling`](https://pandas-profiling.github.io/pandas-profiling/docs/master/rtd/) - это библиотека для генерации интерактивных отчетов на основе пользовательских данных: можем увидеть распределение данных, типы, возможные проблемы.\n", |
| 38 | + "\n", |
| 39 | + "Библиотека очень проста в использовании: можем создать отчет и отправить его кому угодно!" |
| 40 | + ] |
| 41 | + }, |
| 42 | + { |
| 43 | + "cell_type": "code", |
| 44 | + "execution_count": 11, |
| 45 | + "id": "821e23ad", |
| 46 | + "metadata": {}, |
| 47 | + "outputs": [], |
| 48 | + "source": [ |
| 49 | + "# Colab включает старую версию pandas-profiling, поэтому необходимо обновиться:" |
| 50 | + ] |
| 51 | + }, |
| 52 | + { |
| 53 | + "cell_type": "code", |
| 54 | + "execution_count": null, |
| 55 | + "id": "5404065d", |
| 56 | + "metadata": {}, |
| 57 | + "outputs": [], |
| 58 | + "source": [ |
| 59 | + "# actual pandas-profiling compatible substitutor\n", |
| 60 | + "# pip install ydata-profiling==4.7.0" |
| 61 | + ] |
| 62 | + }, |
| 63 | + { |
| 64 | + "cell_type": "code", |
| 65 | + "execution_count": null, |
| 66 | + "id": "a8424602", |
| 67 | + "metadata": {}, |
| 68 | + "outputs": [], |
| 69 | + "source": [ |
| 70 | + "import numpy as np\n", |
| 71 | + "import pandas as pd\n", |
| 72 | + "from ydata_profiling import ProfileReport\n", |
| 73 | + "\n", |
| 74 | + "df = pd.DataFrame(np.random.rand(100, 5), columns=[\"a\", \"b\", \"c\", \"d\", \"e\"])" |
| 75 | + ] |
| 76 | + }, |
| 77 | + { |
| 78 | + "cell_type": "code", |
| 79 | + "execution_count": null, |
| 80 | + "id": "027ad815", |
| 81 | + "metadata": {}, |
| 82 | + "outputs": [], |
| 83 | + "source": [ |
| 84 | + "profile = ProfileReport(df, title=\"Pandas Profiling Report\")" |
| 85 | + ] |
| 86 | + }, |
| 87 | + { |
| 88 | + "cell_type": "code", |
| 89 | + "execution_count": null, |
| 90 | + "id": "785285ed", |
| 91 | + "metadata": {}, |
| 92 | + "outputs": [], |
| 93 | + "source": [ |
| 94 | + "profile.to_widgets()" |
| 95 | + ] |
| 96 | + }, |
| 97 | + { |
| 98 | + "cell_type": "code", |
| 99 | + "execution_count": null, |
| 100 | + "id": "6652e4a3", |
| 101 | + "metadata": {}, |
| 102 | + "outputs": [], |
| 103 | + "source": [ |
| 104 | + "# или отобразить во фрейме блокнота:\n", |
| 105 | + "# profile.to_notebook_iframe()" |
| 106 | + ] |
| 107 | + }, |
| 108 | + { |
| 109 | + "cell_type": "code", |
| 110 | + "execution_count": null, |
| 111 | + "id": "8b3671d6", |
| 112 | + "metadata": {}, |
| 113 | + "outputs": [], |
| 114 | + "source": [ |
| 115 | + "profile.to_file(\"report.html\")" |
| 116 | + ] |
| 117 | + }, |
| 118 | + { |
| 119 | + "cell_type": "markdown", |
| 120 | + "id": "cf0ac67e", |
| 121 | + "metadata": {}, |
| 122 | + "source": [ |
| 123 | + "> HTML-версия отчета доступна по [ссылке](https://dfedorov.spb.ru/pandas/reports/report.html)\n", |
| 124 | + "\n", |
| 125 | + "Авторы библиотеки приводят [результаты анализа данных про Титаник](https://pandas-profiling.github.io/pandas-profiling/examples/master/titanic/titanic_report.html).\n", |
| 126 | + "\n", |
| 127 | + "При работе с большими данными [можно включать минимальный режим](https://pandas-profiling.github.io/pandas-profiling/docs/master/rtd/pages/big_data.html) конфигурирования (`minimal=True`).\n", |
| 128 | + "\n", |
| 129 | + "Разобраться во внутренностях можно через [чтение исходных текстов](https://github.com/pandas-profiling/pandas-profiling/blob/develop/src/pandas_profiling/visualisation/plot.py)." |
| 130 | + ] |
| 131 | + } |
| 132 | + ], |
| 133 | + "metadata": { |
| 134 | + "kernelspec": { |
| 135 | + "display_name": "base", |
| 136 | + "language": "python", |
| 137 | + "name": "python3" |
| 138 | + }, |
| 139 | + "language_info": { |
| 140 | + "codemirror_mode": { |
| 141 | + "name": "ipython", |
| 142 | + "version": 3 |
| 143 | + }, |
| 144 | + "file_extension": ".py", |
| 145 | + "mimetype": "text/x-python", |
| 146 | + "name": "python", |
| 147 | + "nbconvert_exporter": "python", |
| 148 | + "pygments_lexer": "ipython3", |
| 149 | + "version": "3.12.8" |
| 150 | + } |
| 151 | + }, |
| 152 | + "nbformat": 4, |
| 153 | + "nbformat_minor": 5 |
| 154 | +} |
0 commit comments