|
15 | 15 | "execution_count": null,
|
16 | 16 | "metadata": {},
|
17 | 17 | "outputs": [
|
18 |
| - { |
19 |
| - "name": "stderr", |
20 |
| - "output_type": "stream", |
21 |
| - "text": [ |
22 |
| - "[autoreload of fastcore.basics failed: Traceback (most recent call last):\n", |
23 |
| - " File \"c:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\IPython\\extensions\\autoreload.py\", line 276, in check\n", |
24 |
| - " superreload(m, reload, self.old_objects)\n", |
25 |
| - " File \"c:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\IPython\\extensions\\autoreload.py\", line 500, in superreload\n", |
26 |
| - " update_generic(old_obj, new_obj)\n", |
27 |
| - " File \"c:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\IPython\\extensions\\autoreload.py\", line 397, in update_generic\n", |
28 |
| - " update(a, b)\n", |
29 |
| - " File \"c:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\IPython\\extensions\\autoreload.py\", line 365, in update_class\n", |
30 |
| - " update_instances(old, new)\n", |
31 |
| - " File \"c:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\IPython\\extensions\\autoreload.py\", line 323, in update_instances\n", |
32 |
| - " object.__setattr__(ref, \"__class__\", new)\n", |
33 |
| - "TypeError: can't apply this __setattr__ to _InfMeta object\n", |
34 |
| - "]\n", |
35 |
| - "[autoreload of fastcore.foundation failed: Traceback (most recent call last):\n", |
36 |
| - " File \"c:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\IPython\\extensions\\autoreload.py\", line 276, in check\n", |
37 |
| - " superreload(m, reload, self.old_objects)\n", |
38 |
| - " File \"c:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\IPython\\extensions\\autoreload.py\", line 500, in superreload\n", |
39 |
| - " update_generic(old_obj, new_obj)\n", |
40 |
| - " File \"c:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\IPython\\extensions\\autoreload.py\", line 397, in update_generic\n", |
41 |
| - " update(a, b)\n", |
42 |
| - " File \"c:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\IPython\\extensions\\autoreload.py\", line 365, in update_class\n", |
43 |
| - " update_instances(old, new)\n", |
44 |
| - " File \"c:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\IPython\\extensions\\autoreload.py\", line 323, in update_instances\n", |
45 |
| - " object.__setattr__(ref, \"__class__\", new)\n", |
46 |
| - "TypeError: can't apply this __setattr__ to _L_Meta object\n", |
47 |
| - "]\n", |
48 |
| - "[autoreload of fastcore.meta failed: Traceback (most recent call last):\n", |
49 |
| - " File \"c:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\IPython\\extensions\\autoreload.py\", line 276, in check\n", |
50 |
| - " superreload(m, reload, self.old_objects)\n", |
51 |
| - " File \"c:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\IPython\\extensions\\autoreload.py\", line 500, in superreload\n", |
52 |
| - " update_generic(old_obj, new_obj)\n", |
53 |
| - " File \"c:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\IPython\\extensions\\autoreload.py\", line 397, in update_generic\n", |
54 |
| - " update(a, b)\n", |
55 |
| - " File \"c:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\IPython\\extensions\\autoreload.py\", line 365, in update_class\n", |
56 |
| - " update_instances(old, new)\n", |
57 |
| - " File \"c:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\IPython\\extensions\\autoreload.py\", line 323, in update_instances\n", |
58 |
| - " object.__setattr__(ref, \"__class__\", new)\n", |
59 |
| - "TypeError: can't apply this __setattr__ to PrePostInitMeta object\n", |
60 |
| - "]\n" |
61 |
| - ] |
62 |
| - }, |
63 | 18 | {
|
64 | 19 | "name": "stdout",
|
65 | 20 | "output_type": "stream",
|
|
1332 | 1287 | "outputs": [],
|
1333 | 1288 | "source": [
|
1334 | 1289 | "#| export\n",
|
1335 |
| - "def display_df_as_ipydatagrid(df):\n", |
| 1290 | + "def display_df_as_ipydatagrid(df, auto_height=True):\n", |
1336 | 1291 | " from ipydatagrid import DataGrid, TextRenderer\n",
|
1337 | 1292 | " i_renderer = TextRenderer(horizontal_alignment=\"right\", background_color=\"rgb(243, 243, 243)\")\n",
|
1338 | 1293 | " d_renderer = TextRenderer(horizontal_alignment=\"right\")\n",
|
|
1354 | 1309 | " 20 + char_px_width*max((len(str(value)) for value in temp_head[name])),\n",
|
1355 | 1310 | " )\n",
|
1356 | 1311 | " column_widths[\" \"] = 20 + char_px_width*len(str(max(df.index.values)))\n",
|
1357 |
| - " g = DataGrid(df,\n", |
1358 |
| - " index_name=\" \",\n", |
1359 |
| - " editable=False,\n", |
1360 |
| - " selection_mode='cell',\n", |
1361 |
| - " base_row_size=21,\n", |
1362 |
| - " auto_fit_columns=False,\n", |
1363 |
| - " default_renderer=d_renderer,\n", |
1364 |
| - " header_renderer=h_renderer,\n", |
1365 |
| - " renderers={\" \": i_renderer},\n", |
1366 |
| - " column_widths=column_widths,\n", |
1367 |
| - " #layout={\"height\": \"100%\"},\n", |
1368 |
| - " )\n", |
| 1312 | + " g_kwargs = dict(\n", |
| 1313 | + " index_name=\" \",\n", |
| 1314 | + " editable=False,\n", |
| 1315 | + " selection_mode='cell',\n", |
| 1316 | + " base_row_size=21,\n", |
| 1317 | + " auto_fit_columns=False,\n", |
| 1318 | + " default_renderer=d_renderer,\n", |
| 1319 | + " header_renderer=h_renderer,\n", |
| 1320 | + " renderers={\" \": i_renderer},\n", |
| 1321 | + " column_widths=column_widths,\n", |
| 1322 | + " )\n", |
| 1323 | + " if auto_height:\n", |
| 1324 | + " g_kwargs['layout'] = {\"height\": \"100%\"}\n", |
| 1325 | + " g = DataGrid(df, **g_kwargs)\n", |
1369 | 1326 | " g.grid_style = {\n",
|
1370 | 1327 | " \"background_color\": \"rgb(255, 255, 255)\",\n",
|
1371 | 1328 | " \"header_background_color\": \"rgb(243, 243, 243)\",\n",
|
|
1411 | 1368 | {
|
1412 | 1369 | "data": {
|
1413 | 1370 | "application/vnd.jupyter.widget-view+json": {
|
1414 |
| - "model_id": "ce1e6d559d4f4c61b7afb35f179ebb55", |
| 1371 | + "model_id": "70a7b2e8bbdd43adb6c9344bb28dabfe", |
1415 | 1372 | "version_major": 2,
|
1416 | 1373 | "version_minor": 0
|
1417 | 1374 | },
|
1418 | 1375 | "text/plain": [
|
1419 |
| - "DataGrid(auto_fit_params={'area': 'all', 'padding': 30, 'numCols': None}, base_row_size=21, column_widths={'ye…" |
| 1376 | + "DataGrid(auto_fit_params={'area': 'all', 'padding': 30, 'numCols': None}, base_row_size=21, column_widths={'ma…" |
1420 | 1377 | ]
|
1421 | 1378 | },
|
1422 | 1379 | "metadata": {},
|
|
1456 | 1413 | {
|
1457 | 1414 | "data": {
|
1458 | 1415 | "application/vnd.jupyter.widget-view+json": {
|
1459 |
| - "model_id": "c82cd1830aab494ea9f988d1a33e9889", |
| 1416 | + "model_id": "1c0294df9f164257aecd4e1225aa5c24", |
1460 | 1417 | "version_major": 2,
|
1461 | 1418 | "version_minor": 0
|
1462 | 1419 | },
|
|
1471 | 1428 | "source": [
|
1472 | 1429 | "#| eval: False\n",
|
1473 | 1430 | "df = get_df(*browse_df_params('', obs_count(), '.'))\n",
|
1474 |
| - "display_df_as_ipydatagrid(df)" |
| 1431 | + "display_df_as_ipydatagrid(df, False)" |
1475 | 1432 | ]
|
1476 | 1433 | },
|
1477 | 1434 | {
|
|
1486 | 1443 | "traceback": [
|
1487 | 1444 | "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
1488 | 1445 | "\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)",
|
1489 |
| - "Cell \u001b[1;32mIn[144], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;66;03m#| hide\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnbdev\u001b[39;00m; nbdev\u001b[38;5;241m.\u001b[39mnbdev_export()\n", |
| 1446 | + "Cell \u001b[1;32mIn[198], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;66;03m#| hide\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnbdev\u001b[39;00m; nbdev\u001b[38;5;241m.\u001b[39mnbdev_export()\n", |
1490 | 1447 | "File \u001b[1;32mc:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\fastcore\\script.py:112\u001b[0m, in \u001b[0;36mcall_parse.<locals>._f\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 109\u001b[0m \u001b[38;5;129m@wraps\u001b[39m(func)\n\u001b[0;32m 110\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_f\u001b[39m(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[0;32m 111\u001b[0m mod \u001b[38;5;241m=\u001b[39m inspect\u001b[38;5;241m.\u001b[39mgetmodule(inspect\u001b[38;5;241m.\u001b[39mcurrentframe()\u001b[38;5;241m.\u001b[39mf_back)\n\u001b[1;32m--> 112\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m mod: \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 113\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m SCRIPT_INFO\u001b[38;5;241m.\u001b[39mfunc \u001b[38;5;129;01mand\u001b[39;00m mod\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\u001b[38;5;241m==\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m__main__\u001b[39m\u001b[38;5;124m\"\u001b[39m: SCRIPT_INFO\u001b[38;5;241m.\u001b[39mfunc \u001b[38;5;241m=\u001b[39m func\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\n\u001b[0;32m 114\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(sys\u001b[38;5;241m.\u001b[39margv)\u001b[38;5;241m>\u001b[39m\u001b[38;5;241m1\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m sys\u001b[38;5;241m.\u001b[39margv[\u001b[38;5;241m1\u001b[39m]\u001b[38;5;241m==\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m'\u001b[39m: sys\u001b[38;5;241m.\u001b[39margv\u001b[38;5;241m.\u001b[39mpop(\u001b[38;5;241m1\u001b[39m)\n",
|
1491 | 1448 | "File \u001b[1;32mc:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\nbdev\\doclinks.py:149\u001b[0m, in \u001b[0;36mnbdev_export\u001b[1;34m(path, procs, **kwargs)\u001b[0m\n\u001b[0;32m 147\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m procs:\n\u001b[0;32m 148\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnbdev\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mexport\u001b[39;00m\n\u001b[1;32m--> 149\u001b[0m procs \u001b[38;5;241m=\u001b[39m \u001b[43m[\u001b[49m\u001b[38;5;28;43mgetattr\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mnbdev\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexport\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mp\u001b[49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mp\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mL\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprocs\u001b[49m\u001b[43m)\u001b[49m\u001b[43m]\u001b[49m\n\u001b[0;32m 150\u001b[0m files \u001b[38;5;241m=\u001b[39m nbglob(path\u001b[38;5;241m=\u001b[39mpath, as_path\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\u001b[38;5;241m.\u001b[39msorted(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mname\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 151\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m f \u001b[38;5;129;01min\u001b[39;00m files: nb_export(f, procs\u001b[38;5;241m=\u001b[39mprocs)\n",
|
1492 | 1449 | "File \u001b[1;32mc:\\Users\\tjhuegerich\\AppData\\Local\\anaconda3\\envs\\nbstata_dev\\Lib\\site-packages\\nbdev\\doclinks.py:149\u001b[0m, in \u001b[0;36m<listcomp>\u001b[1;34m(.0)\u001b[0m\n\u001b[0;32m 147\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m procs:\n\u001b[0;32m 148\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnbdev\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mexport\u001b[39;00m\n\u001b[1;32m--> 149\u001b[0m procs \u001b[38;5;241m=\u001b[39m [\u001b[38;5;28mgetattr\u001b[39m(\u001b[43mnbdev\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexport\u001b[49m, p) \u001b[38;5;28;01mfor\u001b[39;00m p \u001b[38;5;129;01min\u001b[39;00m L(procs)]\n\u001b[0;32m 150\u001b[0m files \u001b[38;5;241m=\u001b[39m nbglob(path\u001b[38;5;241m=\u001b[39mpath, as_path\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\u001b[38;5;241m.\u001b[39msorted(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mname\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 151\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m f \u001b[38;5;129;01min\u001b[39;00m files: nb_export(f, procs\u001b[38;5;241m=\u001b[39mprocs)\n",
|
|
0 commit comments