-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* use hvplot to support default plotting of dataframes * strip version * run plotting example so plots are visible in docs * add helpful notes * fix formatting issues * use nbsphinx to run notebook while building docs * hide warning from being visible in docs * resolve flake issue * rename to something more specific
- Loading branch information
1 parent
15744ed
commit e5de434
Showing
9 changed files
with
149 additions
and
4 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
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 |
---|---|---|
|
@@ -13,6 +13,7 @@ dependencies: | |
- ipykernel | ||
- jupyter_client | ||
- scikit-learn | ||
- hvplot | ||
|
||
- pip: | ||
- -e ../[all] | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Company,Revenue (in millions) | ||
Walmart,514405 | ||
Exxon Mobil,290212 | ||
Apple,265595 | ||
Berkshire Hathaway,247837 | ||
Amazon.com,232887 |
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,96 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Visualizing Logged Dataframes" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"A `dataframe` is a two-dimensional, tabular dataset with labeled axes (rows and columns) that provides value to the model developer or reviewer when visualized. `rubicon` makes it easy to log dataframes and comes with default visualization support, using [hvplot](https://hvplot.holoviz.org/index.html) under-the-hood. `hvplot` provides an an interactive Bokeh-based plotting API that supports panning, zooming, hovering, and clickable/selectable legends." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Setup\n", | ||
"\n", | ||
"Let's create a project, log a sample dataframe to it, and then visualize it." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from rubicon import Rubicon\n", | ||
"\n", | ||
"rubicon = Rubicon(persistence=\"filesystem\", root_dir=\"./rubicon-root\")\n", | ||
"project = rubicon.get_or_create_project(\"Plotting Example\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Visualizing Dataframes\n", | ||
"\n", | ||
"`Dataframe.plot` exposes plotting functionality to create simple plots like line, bar, scatter, or table plots." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import pandas as pd\n", | ||
"\n", | ||
"df = pd.read_csv(f'./data/revenue_data.csv', index_col=0)\n", | ||
"\n", | ||
"experiment = project.log_experiment(name=\"plotting experiment\")\n", | ||
"dataframe = experiment.log_dataframe(df, description=\"sample revenue df\")\n", | ||
"\n", | ||
"# any args will be passed to hvplot, allowing customization\n", | ||
"revenue_line = dataframe.plot(kind=\"line\", x=\"Company\", \n", | ||
" y=\"Revenue (in millions)\", width=600)\n", | ||
"revenue_scatter = dataframe.plot(kind=\"scatter\", x=\"Company\", \n", | ||
" y=\"Revenue (in millions)\", width=600)\n", | ||
"\n", | ||
"# compatible with holoviews composition\n", | ||
"(revenue_line + revenue_scatter).cols(1)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"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.7.10" | ||
}, | ||
"nbsphinx": { | ||
"execute": "always" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
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