Skip to content

Commit 693b3e4

Browse files
committed
Fix re_log::info! output of tables
1 parent 69e2a58 commit 693b3e4

File tree

2 files changed

+239
-1
lines changed

2 files changed

+239
-1
lines changed

crates/viewer/re_viewer/src/web.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,6 @@ pub fn set_email(email: String) {
909909
// This is required to send bytes around in the notebook.
910910
// If you ever change this, you also need to adapt `notebook.py` too.
911911
pub fn from_arrow_encoded(data: &RecordBatch) -> Result<TableMsg, Box<dyn std::error::Error>> {
912-
re_log::info!("{:?}", data);
913912
let mut metadata = data.schema().metadata().clone();
914913
let id = metadata
915914
.remove("__table_id")
Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"id": "ef6e588c-0ba8-4ce7-b22d-7f640656176c",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"# pixi run py-build-examples\n",
11+
"# pixi run -e examples py-build-notebook\n",
12+
"# pixi run -e examples jupyter notebook /path/to/dataplatform/Indexing.ipynb"
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": 1,
18+
"id": "e5789224-afa8-4250-9eae-2ca570d46088",
19+
"metadata": {},
20+
"outputs": [],
21+
"source": [
22+
"from __future__ import annotations\n",
23+
"\n",
24+
"import os\n",
25+
"\n",
26+
"os.environ[\"RERUN_NOTEBOOK_ASSET\"] = \"inline\""
27+
]
28+
},
29+
{
30+
"cell_type": "code",
31+
"execution_count": 3,
32+
"id": "c993d2ab-5bbb-4af0-89a5-1c370b7b9523",
33+
"metadata": {},
34+
"outputs": [],
35+
"source": [
36+
"import rerun as rr\n",
37+
"\n",
38+
"import pyarrow as pa\n",
39+
"import numpy as np"
40+
]
41+
},
42+
{
43+
"cell_type": "markdown",
44+
"id": "e317e818-4a96-4c63-a9a0-cce25073b2e5",
45+
"metadata": {},
46+
"source": [
47+
"### Send a basic table"
48+
]
49+
},
50+
{
51+
"cell_type": "code",
52+
"execution_count": 6,
53+
"id": "aea716a4-164c-436f-9b6a-ca6f171214b5",
54+
"metadata": {},
55+
"outputs": [
56+
{
57+
"data": {
58+
"application/vnd.jupyter.widget-view+json": {
59+
"model_id": "c014360991394f78875bb5b755a35b79",
60+
"version_major": 2,
61+
"version_minor": 1
62+
},
63+
"text/plain": [
64+
"Viewer()"
65+
]
66+
},
67+
"metadata": {},
68+
"output_type": "display_data"
69+
}
70+
],
71+
"source": [
72+
"viewer = rr.notebook.Viewer(width=1024, height=700)\n",
73+
"viewer.display()\n",
74+
"viewer.send_table(\n",
75+
" \"Hello from Notebook\",\n",
76+
" pa.RecordBatch.from_pydict({\"Column A\": [1, 2, 3], \"Column B\": [\"https://www.rerun.io\", \"Hello\", \"World\"]}),\n",
77+
")"
78+
]
79+
},
80+
{
81+
"cell_type": "markdown",
82+
"id": "59ebc9cb-cb8f-47e9-9beb-a9ff96a7ca17",
83+
"metadata": {},
84+
"source": [
85+
"### Send a Pandas dataframe"
86+
]
87+
},
88+
{
89+
"cell_type": "code",
90+
"execution_count": 9,
91+
"id": "e15fcb31-4e74-47f9-9eba-b6bcdc545c2b",
92+
"metadata": {},
93+
"outputs": [
94+
{
95+
"data": {
96+
"text/html": [
97+
"<div>\n",
98+
"<style scoped>\n",
99+
" .dataframe tbody tr th:only-of-type {\n",
100+
" vertical-align: middle;\n",
101+
" }\n",
102+
"\n",
103+
" .dataframe tbody tr th {\n",
104+
" vertical-align: top;\n",
105+
" }\n",
106+
"\n",
107+
" .dataframe thead th {\n",
108+
" text-align: right;\n",
109+
" }\n",
110+
"</style>\n",
111+
"<table border=\"1\" class=\"dataframe\">\n",
112+
" <thead>\n",
113+
" <tr style=\"text-align: right;\">\n",
114+
" <th></th>\n",
115+
" <th>A</th>\n",
116+
" <th>B</th>\n",
117+
" <th>C</th>\n",
118+
" <th>D</th>\n",
119+
" </tr>\n",
120+
" </thead>\n",
121+
" <tbody>\n",
122+
" <tr>\n",
123+
" <th>2013-01-01</th>\n",
124+
" <td>0.724650</td>\n",
125+
" <td>1.413760</td>\n",
126+
" <td>-0.712906</td>\n",
127+
" <td>-0.846874</td>\n",
128+
" </tr>\n",
129+
" <tr>\n",
130+
" <th>2013-01-02</th>\n",
131+
" <td>-0.290926</td>\n",
132+
" <td>1.258524</td>\n",
133+
" <td>-0.486942</td>\n",
134+
" <td>-1.686135</td>\n",
135+
" </tr>\n",
136+
" <tr>\n",
137+
" <th>2013-01-03</th>\n",
138+
" <td>-2.332377</td>\n",
139+
" <td>0.095785</td>\n",
140+
" <td>-0.077341</td>\n",
141+
" <td>1.556405</td>\n",
142+
" </tr>\n",
143+
" <tr>\n",
144+
" <th>2013-01-04</th>\n",
145+
" <td>1.908649</td>\n",
146+
" <td>-0.493422</td>\n",
147+
" <td>1.764314</td>\n",
148+
" <td>0.450595</td>\n",
149+
" </tr>\n",
150+
" <tr>\n",
151+
" <th>2013-01-05</th>\n",
152+
" <td>0.869452</td>\n",
153+
" <td>-0.471848</td>\n",
154+
" <td>-0.562884</td>\n",
155+
" <td>-0.163650</td>\n",
156+
" </tr>\n",
157+
" <tr>\n",
158+
" <th>2013-01-06</th>\n",
159+
" <td>2.075900</td>\n",
160+
" <td>1.014085</td>\n",
161+
" <td>0.501736</td>\n",
162+
" <td>-0.440392</td>\n",
163+
" </tr>\n",
164+
" </tbody>\n",
165+
"</table>\n",
166+
"</div>"
167+
],
168+
"text/plain": [
169+
" A B C D\n",
170+
"2013-01-01 0.724650 1.413760 -0.712906 -0.846874\n",
171+
"2013-01-02 -0.290926 1.258524 -0.486942 -1.686135\n",
172+
"2013-01-03 -2.332377 0.095785 -0.077341 1.556405\n",
173+
"2013-01-04 1.908649 -0.493422 1.764314 0.450595\n",
174+
"2013-01-05 0.869452 -0.471848 -0.562884 -0.163650\n",
175+
"2013-01-06 2.075900 1.014085 0.501736 -0.440392"
176+
]
177+
},
178+
"execution_count": 9,
179+
"metadata": {},
180+
"output_type": "execute_result"
181+
}
182+
],
183+
"source": [
184+
"dates = pd.date_range(\"20130101\", periods=6)\n",
185+
"df = pd.DataFrame(np.random.randn(6, 4), index=dates, columns=list(\"ABCD\"))\n",
186+
"df_reset = df.reset_index().rename(columns={'index': 'date'})\n",
187+
"df"
188+
]
189+
},
190+
{
191+
"cell_type": "code",
192+
"execution_count": 10,
193+
"id": "837e06ba-ad72-4dff-a6f4-5e7e211a137d",
194+
"metadata": {},
195+
"outputs": [
196+
{
197+
"data": {
198+
"application/vnd.jupyter.widget-view+json": {
199+
"model_id": "ddee9f4e26d5406ab823a792fe7c80ff",
200+
"version_major": 2,
201+
"version_minor": 1
202+
},
203+
"text/plain": [
204+
"Viewer()"
205+
]
206+
},
207+
"metadata": {},
208+
"output_type": "display_data"
209+
}
210+
],
211+
"source": [
212+
"viewer = rr.notebook.Viewer(width=1024, height=700)\n",
213+
"viewer.display()\n",
214+
"viewer.send_table(\"Hello from Pandas\", pa.RecordBatch.from_pandas(df))"
215+
]
216+
}
217+
],
218+
"metadata": {
219+
"kernelspec": {
220+
"display_name": "Python 3 (ipykernel)",
221+
"language": "python",
222+
"name": "python3"
223+
},
224+
"language_info": {
225+
"codemirror_mode": {
226+
"name": "ipython",
227+
"version": 3
228+
},
229+
"file_extension": ".py",
230+
"mimetype": "text/x-python",
231+
"name": "python",
232+
"nbconvert_exporter": "python",
233+
"pygments_lexer": "ipython3",
234+
"version": "3.11.10"
235+
}
236+
},
237+
"nbformat": 4,
238+
"nbformat_minor": 5
239+
}

0 commit comments

Comments
 (0)