Skip to content

Commit

Permalink
documentation and cleaning
Browse files Browse the repository at this point in the history
* added notebook gallery
* update README
* removed scatterplot message in SQLExecutor
* fixed typo in SQL documentation
  • Loading branch information
dorisjlee committed Apr 19, 2021
1 parent d6cca26 commit e3a283c
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 14 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@
</a>
</p>

Lux is a Python library that makes data science easier by automating aspects of the data exploration process. Lux facilitate faster experimentation with data, even when the user does not have a clear idea of what they are looking for. Visualizations are displayed via [an interactive widget](https://github.com/lux-org/lux-widget) that allow users to quickly browse through large collections of visualizations directly within their Jupyter notebooks.
Lux is a Python library that facilitate fast and easy data exploration by automating the visualization and data analysis process. By simply printing out a dataframe in a Jupyter notebook, Lux recommends a set of visualizations highlighting interesting trends and patterns in the dataset. Visualizations are displayed via [an interactive widget](https://github.com/lux-org/lux-widget) that enables users to quickly browse through large collections of visualizations and make sense of their data.

<img src="https://github.com/lux-org/lux-resources/blob/master/readme_img/demohighlight.gif?raw=true"
alt="Highlighted Visual Dataframe Workflow with Lux"
style="width:900px" />

Here is a [1-min video](https://www.youtube.com/watch?v=qmnYP-LmbNU) introducing Lux, and [slides](http://dorisjunglinlee.com/files/Zillow_07_2020_Slide.pdf) from a more extended talk.

Try out Lux on your own in a live Jupyter Notebook [here](https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/demo/employee_demo.ipynb)!
Check out our [notebook gallery](https://lux-api.readthedocs.io/en/latest/source/reference/gallery.html) with examples of how Lux can be used with a variety of dataset and analysis scenarios.
<br>Or try out Lux on your own in a [live Jupyter Notebook](https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/demo/employee_demo.ipynb)!

# Getting Started

Expand Down Expand Up @@ -93,7 +98,7 @@ df

### Easy programmatic access and export of visualizations:

Now that we have found some interesting visualizations through Lux, we might be interested in digging into these visualizations a bit more or sharing it with others. We can save the visualizations generated in Lux as a [static, shareable HTML](https://lux-api.readthedocs.io/en/latest/source/guide/export.html#exporting-widget-visualizations-as-static-html) or programmatically access these visualizations further in Jupyter. Selected `Vis` objects can be translated into [Altair](http://altair-viz.github.io/) or [Vega-Lite](https://vega.github.io/vega-lite/) code, so that they can be further edited.
Now that we have found some interesting visualizations through Lux, we might be interested in digging into these visualizations a bit more or sharing it with others. We can save the visualizations generated in Lux as a [static, shareable HTML](https://lux-api.readthedocs.io/en/latest/source/guide/export.html#exporting-widget-visualizations-as-static-html) or programmatically access these visualizations further in Jupyter. Selected `Vis` objects can be translated into [Altair](http://altair-viz.github.io/), [Matplotlib](https://matplotlib.org/), or [Vega-Lite](https://vega.github.io/vega-lite/) code, so that they can be further edited.

<img src="https://github.com/lux-org/lux-resources/blob/master/readme_img/export.gif?raw=true"
alt="Easily exportable visualization object"
Expand Down Expand Up @@ -134,7 +139,7 @@ To find out more about other features in Lux, see the complete documentation on
# Installation & Setup

To get started, please follow both the installation and setup instructions in your command line.
`lux-api` can be installed through [PyPI](https://pypi.org/project/lux-api/).
`lux-api` can be installed through [PyPI](https://pypi.org/project/lux-api/) or [conda-forge](https://github.com/conda-forge/lux-api-feedstock).

```bash
pip install lux-api
Expand Down Expand Up @@ -162,13 +167,13 @@ Note that you may have to restart the Jupyter Notebook server to ensure that the

## Setup in Jupyter Lab

To use Lux in [Jupyter Lab](https://github.com/jupyterlab/jupyterlab), activate the lab extension:
Lux is compatible with both Jupyter Lab version 2 and 3. To use Lux in [Jupyter Lab](https://github.com/jupyterlab/jupyterlab), activate the lab extension:

```bash
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install luxwidget
```
Lux is only compatible with Jupyter Lab version 2.2.9 and below. Support for the recent [JupyterLab 3](https://blog.jupyter.org/jupyterlab-3-0-is-out-4f58385e25bb) will come soon. Note that JupyterLab and VSCode is supported only for lux-widget version >=0.1.2, if you have an earlier version, please upgrade to the latest version of [lux-widget](https://pypi.org/project/lux-widget/). Lux has only been tested with the Chrome browser.
Note that JupyterLab and VSCode is supported only for lux-widget version >=0.1.2, if you have an earlier version, please upgrade to the latest version of [lux-widget](https://pypi.org/project/lux-widget/). Lux has only been tested with the Chrome browser.

If you encounter issues with the installation, please refer to [this page](https://lux-api.readthedocs.io/en/latest/source/guide/FAQ.html#troubleshooting-tips) to troubleshoot the installation. Follow [these instructions](https://lux-api.readthedocs.io/en/latest/source/getting_started/installation.html#manual-installation-dev-setup) to set up Lux for development purposes.

Expand Down
3 changes: 1 addition & 2 deletions doc/source/advanced/executor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ To do this, users first need to specify a connection to their SQL database. This
engine = create_engine("postgresql://postgres:lux@localhost:5432")
Note that users will have to install these packages on their own if they want to connect Lux to their databases.
Once this connection is created, users can connect the lux config to the database using the :code:`set_SQL_connection` command.
Once this connection is created, users can connect Lux to their database using the :code:`set_SQL_connection` command.

.. code-block:: python
Expand All @@ -54,7 +54,6 @@ Connecting a LuxSQLTable to a Table/View
----------------------------------------

LuxSQLTables can be connected to individual tables or views created within your Postgresql database. This can be done by specifying the table or view name in the constructor.
.. We are actively working on supporting joins between multiple tables. But as of now, the functionality is limited to one table or view per LuxSQLTable object only.

.. code-block:: python
Expand Down
61 changes: 61 additions & 0 deletions doc/source/reference/gallery.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

Gallery of Notebook Examples
==============================

Demo Examples
------------------
The following notebooks demonstrates how Lux can be used with a variety of different datasets and analysis

- Basic walkthrough of Lux with the Cars dataset [`Source <https://github.com/lux-org/lux-binder/blob/master/demo/cars_demo.ipynb>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/demo/cars_demo.ipynb>`_]
- Basic walkthrough of Lux with the College dataset [`Source <https://github.com/lux-org/lux-binder/blob/master/demo/college_demo.ipynb>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/demo/college_demo.ipynb>`_]
- Understanding Global COVID-19 intervention levels [`Source <https://github.com/lux-org/lux-binder/blob/master/demo/hpi_covid_demo.ipynb>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/demo/hpi_covid_demo.ipynb>`_]
- Understanding factors leading to Employee attrition [`Source <https://github.com/lux-org/lux-binder/blob/master/demo/employee_demo.ipynb>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/demo/employee_demo.ipynb>`_]

If you would like to try out Lux on your own, we provide a `notebook environment <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/demo/exercise/4-Data-Playground.ipynb>`_ for you to play around with several provided example datasets.

Tutorials
---------

The following tutorials cover the most basic to advanced features in Lux. The first five tutorials introduces the core features in Lux:

- Overview of Features in Lux [`Source <https://github.com/lux-org/lux-binder/blob/master/tutorial/0-overview.ipynb>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/tutorial/0-overview.ipynb>`_]
- Specifying user analysis intent in Lux [`Source <https://github.com/lux-org/lux-binder/blob/master/tutorial/1-specifying-intent.ipynb>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/tutorial/1-specifying-intent.ipynb>`_]
- Creating quick-and-dirty visualizations with :code:`Vis` and :code:`VisList` [`Source <https://github.com/lux-org/lux-binder/blob/master/tutorial/2-constructing-vis-and-vislist.ipynb>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/tutorial/2-constructing-vis-and-vislist.ipynb>`_]
- Seamless export of :code:`Vis` from notebook to downstream tasks [`Source <https://github.com/lux-org/lux-binder/blob/master/tutorial/3-widget-vis-export.ipynb>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/tutorial/3-widget-vis-export.ipynb>`_]
- Customizing plot styling with :code:`lux.config.plotting_style` [`Source <https://github.com/lux-org/lux-binder/blob/master/tutorial/4-chart-settings.ipynb>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/tutorial/4-chart-settings.ipynb>`_]

The following notebooks covers more advanced topics in Lux:

- Understanding data types in Lux [`Source <https://github.com/lux-org/lux-binder/blob/master/tutorial/9-datatype.ipynb?>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/tutorial/9-datatype.ipynb?raw=true>`_]
- Working with datetime columns [`Source <https://github.com/lux-org/lux-binder/blob/master/tutorial/tutorial/5-datetime.ipynb>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/tutorial/5-datetime.ipynb>`_]
- Working with geographic columns [`ReadTheDocs <https://lux-api.readthedocs.io/en/latest/source/advanced/map.html>`_]
- Working with dataframe indexes [`Source <https://github.com/lux-org/lux-binder/blob/master/tutorial/tutorial/6-index-group.ipynb>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/tutorial/6-index-group.ipynb>`_]
- Registering custom recommendation actions [`Source <https://github.com/lux-org/lux-binder/blob/master/tutorial/8-custom-action.ipynb>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/tutorial/8-custom-action.ipynb>`_]
- Using Lux with a SQL Database [`Source <https://github.com/lux-org/lux-binder-sql/blob/master/notebooks/Using%20Lux%20with%20SQL%20Databases.ipynb>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder-sql/HEAD>`_]


Exercise
---------

Here are some teaching resources on Lux. The materials are suited for a 1-1.5 hour industry bootcamp or lecture for a data visualization or data science course. Here is a `video <https://www.youtube.com/watch?v=YANIids_Nkk>`_ that walks through these hands-on exercise on Lux. To follow along, check out the instructions `here <https://github.com/lux-org/lux-binder>`_.

1. How to specify your analysis interests as `intents` in Lux? [`Source <https://github.com/lux-org/lux-binder/blob/master/exercise/1-Specify-Intent.ipynb>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/exercise/1-Specify-Intent.ipynb>`_]

2. How to create visualizations using :code:`Vis` and :code:`VisList`? [`Source <https://github.com/lux-org/lux-binder/blob/master/exercise/2-Quick-Vis.ipynb>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/exercise/2-Quick-Vis.ipynb>`_]

3. How to export selected visualization(s) out of the notebook for sharing? [`Source <https://github.com/lux-org/lux-binder/blob/master/exercise/3-Export-Widget.ipynb>`_] [`Live Notebook <https://mybinder.org/v2/gh/lux-org/lux-binder/master?urlpath=tree/exercise/3-Export-Widget.ipynb>`_]

Here are the `solutions <https://github.com/lux-org/lux-binder/blob/master/exercise/solution.txt>`_ to the notebook exercises.


Community Contributions
-------------------------
Here are some awesome articles and tutorials written by the Lux community:

- `Exploring the Penguins dataset with Lux by Parul Pandey <https://towardsdatascience.com/intelligent-visual-data-discovery-with-lux-a-python-library-dc36a5742b2f>`_
- `Analysis of the Wine dataset by Domino Data Lab <https://blog.dominodatalab.com/faster-data-exploration-in-jupyter-through-the-lux-widget/>`_
- `Quick Recommendation-Based Data Exploration with Lux by Cornellius Yudha Wijaya <https://towardsdatascience.com/quick-recommendation-based-data-exploration-with-lux-f4d0ccb68133>`_
- `Analyzing the Graduate Admissions dataset with Lux by Pranavi Duvva <https://pub.towardsai.net/speed-up-eda-with-the-intelligent-lux-37f96542527b>`_


If you would like your notebook or articles to be featured here, please submit a pull request `here <https://github.com/lux-org/lux-binder>`_ to let us know!
1 change: 1 addition & 0 deletions doc/source/reference/gen/lux.core.frame.LuxDataFrame.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
~LuxDataFrame.set_intent_as_vis
~LuxDataFrame.set_intent_on_click
~LuxDataFrame.shift
~LuxDataFrame.show_all_column_vis
~LuxDataFrame.skew
~LuxDataFrame.slice_shift
~LuxDataFrame.sort_index
Expand Down
6 changes: 0 additions & 6 deletions lux/executor/SQLExecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,6 @@ def add_quotes(var_name):
query = "SELECT {} FROM {} {}".format(required_variables, tbl.table_name, where_clause)
data = pandas.read_sql(query, lux.config.SQLconnection)
view._vis_data = utils.pandas_to_lux(data)
# view._vis_data.length = list(length_query["length"])[0]

tbl._message.add_unique(
f"Large scatterplots detected: Lux is automatically binning scatterplots to heatmaps.",
priority=98,
)

@staticmethod
def execute_aggregate(view: Vis, tbl: LuxSQLTable, isFiltered=True):
Expand Down

0 comments on commit e3a283c

Please sign in to comment.