Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e706f24

Browse files
committed
🔥 Add notebook ipython memory usage
1 parent 1ebe137 commit e706f24

1 file changed

Lines changed: 242 additions & 0 deletions

File tree

Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {
7+
"execution": {
8+
"iopub.execute_input": "2020-09-02T20:37:09.340743Z",
9+
"iopub.status.busy": "2020-09-02T20:37:09.340488Z",
10+
"iopub.status.idle": "2020-09-02T20:37:09.469906Z",
11+
"shell.execute_reply": "2020-09-02T20:37:09.468326Z",
12+
"shell.execute_reply.started": "2020-09-02T20:37:09.340700Z"
13+
}
14+
},
15+
"outputs": [],
16+
"source": [
17+
"import ipython_memory_usage"
18+
]
19+
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": 2,
23+
"metadata": {
24+
"execution": {
25+
"iopub.execute_input": "2020-09-02T20:37:09.472168Z",
26+
"iopub.status.busy": "2020-09-02T20:37:09.471901Z",
27+
"iopub.status.idle": "2020-09-02T20:37:09.589613Z",
28+
"shell.execute_reply": "2020-09-02T20:37:09.588325Z",
29+
"shell.execute_reply.started": "2020-09-02T20:37:09.472122Z"
30+
}
31+
},
32+
"outputs": [
33+
{
34+
"data": {
35+
"text/plain": [
36+
"'memory profile enabled'"
37+
]
38+
},
39+
"execution_count": 2,
40+
"metadata": {},
41+
"output_type": "execute_result"
42+
},
43+
{
44+
"name": "stdout",
45+
"output_type": "stream",
46+
"text": [
47+
"In [2] used 0.1211 MiB RAM in 0.12s, peaked 0.00 MiB above current, total RAM usage 44.46 MiB\n"
48+
]
49+
}
50+
],
51+
"source": [
52+
"%ipython_memory_usage_start"
53+
]
54+
},
55+
{
56+
"cell_type": "code",
57+
"execution_count": 3,
58+
"metadata": {
59+
"execution": {
60+
"iopub.execute_input": "2020-09-02T20:37:09.591153Z",
61+
"iopub.status.busy": "2020-09-02T20:37:09.590927Z",
62+
"iopub.status.idle": "2020-09-02T20:37:09.861199Z",
63+
"shell.execute_reply": "2020-09-02T20:37:09.858674Z",
64+
"shell.execute_reply.started": "2020-09-02T20:37:09.591116Z"
65+
}
66+
},
67+
"outputs": [
68+
{
69+
"name": "stdout",
70+
"output_type": "stream",
71+
"text": [
72+
"In [3] used 8.9805 MiB RAM in 0.26s, peaked 0.00 MiB above current, total RAM usage 53.44 MiB\n"
73+
]
74+
}
75+
],
76+
"source": [
77+
"import numpy as np"
78+
]
79+
},
80+
{
81+
"cell_type": "code",
82+
"execution_count": 4,
83+
"metadata": {
84+
"execution": {
85+
"iopub.execute_input": "2020-09-02T20:37:09.862962Z",
86+
"iopub.status.busy": "2020-09-02T20:37:09.862720Z",
87+
"iopub.status.idle": "2020-09-02T20:37:10.011283Z",
88+
"shell.execute_reply": "2020-09-02T20:37:10.009740Z",
89+
"shell.execute_reply.started": "2020-09-02T20:37:09.862924Z"
90+
}
91+
},
92+
"outputs": [
93+
{
94+
"name": "stdout",
95+
"output_type": "stream",
96+
"text": [
97+
"In [4] used 76.3555 MiB RAM in 0.14s, peaked 0.00 MiB above current, total RAM usage 129.80 MiB\n"
98+
]
99+
}
100+
],
101+
"source": [
102+
"a = np.ones(int(1e7))"
103+
]
104+
},
105+
{
106+
"cell_type": "code",
107+
"execution_count": 5,
108+
"metadata": {
109+
"execution": {
110+
"iopub.execute_input": "2020-09-02T20:37:10.014996Z",
111+
"iopub.status.busy": "2020-09-02T20:37:10.014698Z",
112+
"iopub.status.idle": "2020-09-02T20:37:10.635785Z",
113+
"shell.execute_reply": "2020-09-02T20:37:10.634827Z",
114+
"shell.execute_reply.started": "2020-09-02T20:37:10.014912Z"
115+
}
116+
},
117+
"outputs": [
118+
{
119+
"name": "stdout",
120+
"output_type": "stream",
121+
"text": [
122+
"In [5] used 30.2773 MiB RAM in 0.62s, peaked 0.00 MiB above current, total RAM usage 160.07 MiB\n"
123+
]
124+
}
125+
],
126+
"source": [
127+
"import pandas as pd"
128+
]
129+
},
130+
{
131+
"cell_type": "code",
132+
"execution_count": 6,
133+
"metadata": {
134+
"execution": {
135+
"iopub.execute_input": "2020-09-02T20:37:10.638024Z",
136+
"iopub.status.busy": "2020-09-02T20:37:10.637746Z",
137+
"iopub.status.idle": "2020-09-02T20:37:10.748009Z",
138+
"shell.execute_reply": "2020-09-02T20:37:10.746856Z",
139+
"shell.execute_reply.started": "2020-09-02T20:37:10.637977Z"
140+
}
141+
},
142+
"outputs": [
143+
{
144+
"name": "stdout",
145+
"output_type": "stream",
146+
"text": [
147+
"In [6] used 0.0977 MiB RAM in 0.10s, peaked 0.00 MiB above current, total RAM usage 160.17 MiB\n"
148+
]
149+
}
150+
],
151+
"source": [
152+
"df = pd.DataFrame(a)"
153+
]
154+
},
155+
{
156+
"cell_type": "code",
157+
"execution_count": 7,
158+
"metadata": {
159+
"execution": {
160+
"iopub.execute_input": "2020-09-02T20:37:10.749908Z",
161+
"iopub.status.busy": "2020-09-02T20:37:10.749623Z",
162+
"iopub.status.idle": "2020-09-02T20:37:10.861548Z",
163+
"shell.execute_reply": "2020-09-02T20:37:10.859248Z",
164+
"shell.execute_reply.started": "2020-09-02T20:37:10.749870Z"
165+
}
166+
},
167+
"outputs": [
168+
{
169+
"data": {
170+
"text/plain": [
171+
"Index 128\n",
172+
"0 80000000\n",
173+
"dtype: int64"
174+
]
175+
},
176+
"execution_count": 7,
177+
"metadata": {},
178+
"output_type": "execute_result"
179+
},
180+
{
181+
"name": "stdout",
182+
"output_type": "stream",
183+
"text": [
184+
"In [7] used 0.3008 MiB RAM in 0.11s, peaked 0.00 MiB above current, total RAM usage 160.47 MiB\n"
185+
]
186+
}
187+
],
188+
"source": [
189+
"df.memory_usage(deep=True)"
190+
]
191+
},
192+
{
193+
"cell_type": "code",
194+
"execution_count": 8,
195+
"metadata": {
196+
"execution": {
197+
"iopub.execute_input": "2020-09-02T20:37:10.863013Z",
198+
"iopub.status.busy": "2020-09-02T20:37:10.862775Z",
199+
"iopub.status.idle": "2020-09-02T20:37:10.869681Z",
200+
"shell.execute_reply": "2020-09-02T20:37:10.868674Z",
201+
"shell.execute_reply.started": "2020-09-02T20:37:10.862973Z"
202+
}
203+
},
204+
"outputs": [
205+
{
206+
"data": {
207+
"text/plain": [
208+
"'memory profile disabled'"
209+
]
210+
},
211+
"execution_count": 8,
212+
"metadata": {},
213+
"output_type": "execute_result"
214+
}
215+
],
216+
"source": [
217+
"%ipython_memory_usage_stop"
218+
]
219+
}
220+
],
221+
"metadata": {
222+
"kernelspec": {
223+
"display_name": "Python 3",
224+
"language": "python",
225+
"name": "python3"
226+
},
227+
"language_info": {
228+
"codemirror_mode": {
229+
"name": "ipython",
230+
"version": 3
231+
},
232+
"file_extension": ".py",
233+
"mimetype": "text/x-python",
234+
"name": "python",
235+
"nbconvert_exporter": "python",
236+
"pygments_lexer": "ipython3",
237+
"version": "3.7.7"
238+
}
239+
},
240+
"nbformat": 4,
241+
"nbformat_minor": 4
242+
}

0 commit comments

Comments
 (0)