-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix for the issue of merging nested rows
Signed-off-by: Rasmus Lundsgaard <[email protected]>
- Loading branch information
1 parent
825a02a
commit 93be7a5
Showing
6 changed files
with
115 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+25.1 KB
...agrid.test.ts-snapshots/dark-datagrid-nested-hierarchies-ipynb-cell-0-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+25.2 KB
...grid.test.ts-snapshots/light-datagrid-nested-hierarchies-ipynb-cell-0-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions
69
ui-tests-ipw8/tests/notebooks/datagrid_nested_hierarchies.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "30354eb9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import pandas as pd\n", | ||
"import ipydatagrid as g\n", | ||
"\n", | ||
"np.random.seed(1)\n", | ||
"\n", | ||
"# merging of lower level row headers\n", | ||
"col_top_level = [\n", | ||
" \"VeryLongValueFactors\",\n", | ||
" \"VeryLongValueFactors\",\n", | ||
" \"Even Longer Momentum Factors\",\n", | ||
" \"Even Longer Momentum Factors\",\n", | ||
"]\n", | ||
"col_bottom_level = [\"Factor_A\", \"Factor_B\", \"Factor_C\", \"Factor_D\"]\n", | ||
"# Rows\n", | ||
"row_top_level = [\"Sector 1\", \"Sector 1\", \"Sector 2\", \"Sector 2\", \"Sector 3\"]\n", | ||
"row_bottom_level = [\"Security A\", \"Security B\", \"Security C\", \"Security C\", \"Security C\"]\n", | ||
"\n", | ||
"nested_df = pd.DataFrame(\n", | ||
" np.random.randn(5, 4).round(4),\n", | ||
" columns=pd.MultiIndex.from_arrays([col_top_level, col_bottom_level]),\n", | ||
" index=pd.MultiIndex.from_arrays(\n", | ||
" [row_top_level, row_bottom_level], names=(\"Sector\", \"Ticker\")\n", | ||
" ),\n", | ||
")\n", | ||
"\n", | ||
"nested_grid = g.DataGrid(\n", | ||
" nested_df,\n", | ||
" base_column_size=80,\n", | ||
" base_column_header_size=35,\n", | ||
" base_row_header_size=80,\n", | ||
" layout={\"height\": \"180px\"}\n", | ||
")\n", | ||
"\n", | ||
"nested_grid" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters