Skip to content

Commit

Permalink
Removing show_toolbar from the sample notebook for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Shawver committed Feb 16, 2016
1 parent f3f7935 commit a78f80d
Showing 1 changed file with 79 additions and 6 deletions.
85 changes: 79 additions & 6 deletions qgrid_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Interactive Tutorial - Editing a DataFrame returned by Yahoo Finance\n",
"\n",
"The cells in this section will walk you through a series of function calls that will demonstrate qgrid's features.\n",
"## Example 1 - Render a DataFrame returned by Yahoo Finance\n",
"\n",
"### 1. Create a sample DataFrame using pandas 'get_data_yahoo' function"
]
Expand Down Expand Up @@ -167,9 +165,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### 4. Show the add/remove row buttons and set some grid_options\n",
"### 3. Now render with qgrid again, and tweak some options\n",
"The `show_grid` function takes a number of optional parameters to allow you to configure the behavior of the grid it generates. In the following example we use a couple of these optional parameters:\n",
"* `show_toolbar` takes a boolean and defaults to False. When set to True, a toolbar gets shown on top of the grid with some useful editing controls. If you're viewing this notebook on nbviewer, those editing controls won't be visible.\n",
"\n",
"* `precision` is the number of digits of precision to display for floating-point values. If unset, we use the value of pandas.get_option(‘display.precision’).\n",
"* `grid_options` takes a dict and allows you to pass any of the \"grid options\" listed in [SlickGrid's documentation](https://github.com/mleibman/SlickGrid/wiki/Grid-Options). In this example we make use of two of these options, `forceFitColumns` and `defaultColumnWidth`, to improve qgrid's ability to handle a large number of columns\n",
"\n",
"You can read about these and the rest of the optional parameters for the `show_grid` function in our [API documentation](http://qgrid.readthedocs.org/en/latest/#qgrid.show_grid). \n",
Expand All @@ -185,7 +184,81 @@
},
"outputs": [],
"source": [
"qgrid.show_grid(spy, show_toolbar=True, grid_options={'forceFitColumns': False, 'defaultColumnWidth': 200})"
"qgrid.show_grid(spy, precision=2, grid_options={'forceFitColumns': False, 'defaultColumnWidth': 200})"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"*The same 'spy' DataFrame rendered as a qgrid again, this time some options tweaked. Precision has been decreased to 2, the columns are wider, and a horizontal scroll bar has appeared.*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 2 - Rendering a grid containing some different data types"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1. Create a new sample DataFrame "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"df2 = pd.DataFrame({\n",
" 'A' : 1.,\n",
" 'B' : pd.Timestamp('20130102'),\n",
" 'C' : pd.Series(randn(8),index=list(range(8)),dtype='float32'),\n",
" 'D' : np.array([3] * 8,dtype='int32'),\n",
" 'E' : pd.Categorical([\"test\",\"train\",\"test\",\"train\", \"test\", \"train\", \"test\", \"train\"]),\n",
" 'F' : 'foo' })"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 2. Render the DataFrame without using qgrid"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"df2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 3. Render the DataFrame again, this time using qgrid"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"qgrid.show_grid(df2)"
]
}
],
Expand Down

0 comments on commit a78f80d

Please sign in to comment.