Lux
Automatically visualize your pandas dataframe via a single print! 📊 💡
Install / Use
/learn @lux-org/LuxREADME
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 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 introducing Lux, and slides from a more extended talk.
Check out our notebook gallery with examples of how Lux can be used with different datasets and analyses. <br>Or try out Lux on your own in a live Jupyter Notebook!
Getting Started
To start using Lux, simply add an extra import statement along with your Pandas import.
import lux
import pandas as pd
Lux can be used without modifying any existing Pandas code. Here, we use Pandas's read_csv command to load in a dataset of colleges and their properties.
df = pd.read_csv("https://raw.githubusercontent.com/lux-org/lux-datasets/master/data/college.csv")
df
When the dataframe is printed out, Lux automatically recommends a set of visualizations highlighting interesting trends and patterns in the dataset.
<img src="https://github.com/lux-org/lux-resources/blob/master/readme_img/basicDemo.gif?raw=true" alt="Basic recommendations in Lux" style="width:900px" />
Voila! Here's a set of visualizations that you can now use to explore your dataset further!
Next-step recommendations based on user intent:
In addition to dataframe visualizations at every step in the exploration, you can specify to Lux the attributes and values you're interested in. Based on this intent, Lux guides users towards potential next-steps in their exploration.
For example, we might be interested in the attributes AverageCost and SATAverage.
df.intent = ["AverageCost","SATAverage"]
df
<img src="https://github.com/lux-org/lux-resources/blob/master/readme_img/contextRec.gif?raw=true" alt="Next-step Recommendations Based on User Context" style="width:600px" />
The left-hand side of the widget shows the current visualization, i.e., the current visualization generated based on what the user is interested in. On the right, Lux generates three sets of recommendations, organized as separate tabs on the widget:
Enhanceadds an additional attribute to the current selection, essentially highlighting how additional variables affect the relationship ofAverageCostandSATAverage. We see that if we breakdown the relationship byFundingModel, there is a clear separation between public colleges (shown in red) and private colleges (in blue), with public colleges being cheaper to attend and with SAT average of lower than 1400. <img src="https://github.com/lux-org/lux-resources/blob/master/readme_img/enhance.png?raw=true" alt="Enhance Recommendations" style="width:600px" />Filteradds a filter to the current selection, while keeping attributes (on the X and Y axes) fixed. These visualizations show how the relationship ofAverageCostandSATAveragechanges for different subsets of data. For instance, we see that colleges that offer Bachelor's degree as its highest degree show a roughly linear trend between the two variables. <img src="https://github.com/lux-org/lux-resources/blob/master/readme_img/filter.png?raw=true" alt="Filter Recommendations" style="width:600px" />Generalizeremoves an attribute to display a more general trend, showing the distributions ofAverageCostandSATAverageon its own. From theAverageCosthistogram, we see that many colleges with average cost of around $20000 per year, corresponding to the bulge we see in the scatterplot view. <img src="https://github.com/lux-org/lux-resources/blob/master/readme_img/generalize.png?raw=true" alt="Generalize Recommendations" style="width:600px" />
See this page for more information on additional ways for specifying the intent.
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 or programmatically access these visualizations further in Jupyter. Selected Vis objects can be translated into Altair, Matplotlib, or 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" style="width:600px" />
Learn more about how to save and export visualizati
