Skip to content

Commit cb7939e

Browse files
committed
Fedorov course notes [SENATOROVAI#4] (SENATOROVAI/DA#4)
Closes SENATOROVAI/DA#4
1 parent d2ac225 commit cb7939e

File tree

2 files changed

+199
-0
lines changed

2 files changed

+199
-0
lines changed
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
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+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
"""Using the Pandas Profiling module for profiling."""
2+
3+
# # Использование модуля Pandas Profiling для профилирования
4+
5+
# [`Pandas Profiling`](https://pandas-profiling.github.io/pandas-profiling/docs/master/rtd/) - это библиотека для генерации интерактивных отчетов на основе пользовательских данных: можем увидеть распределение данных, типы, возможные проблемы.
6+
#
7+
# Библиотека очень проста в использовании: можем создать отчет и отправить его кому угодно!
8+
9+
# +
10+
# Colab включает старую версию pandas-profiling, поэтому необходимо обновиться:
11+
12+
# +
13+
# actual pandas-profiling compatible substitutor
14+
# pip install ydata-profiling==4.7.0
15+
16+
# +
17+
import numpy as np
18+
import pandas as pd
19+
from ydata_profiling import ProfileReport
20+
21+
df = pd.DataFrame(
22+
np.random.rand(100, 5),
23+
columns=['a', 'b', 'c', 'd', 'e']
24+
)
25+
# -
26+
27+
profile = ProfileReport(df,
28+
title='Pandas Profiling Report')
29+
30+
profile.to_widgets()
31+
32+
# +
33+
# или отобразить во фрейме блокнота:
34+
#profile.to_notebook_iframe()
35+
# -
36+
37+
profile.to_file("report.html")
38+
39+
# > HTML-версия отчета доступна по [ссылке](https://dfedorov.spb.ru/pandas/reports/report.html)
40+
#
41+
# Авторы библиотеки приводят [результаты анализа данных про Титаник](https://pandas-profiling.github.io/pandas-profiling/examples/master/titanic/titanic_report.html).
42+
#
43+
# При работе с большими данными [можно включать минимальный режим](https://pandas-profiling.github.io/pandas-profiling/docs/master/rtd/pages/big_data.html) конфигурирования (`minimal=True`).
44+
#
45+
# Разобраться во внутренностях можно через [чтение исходных текстов](https://github.com/pandas-profiling/pandas-profiling/blob/develop/src/pandas_profiling/visualisation/plot.py).

0 commit comments

Comments
 (0)