diff --git a/doc/conf.py b/doc/conf.py index 03862439..cafb3786 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -63,7 +63,7 @@ "sphinx_automodapi.automodsumm", ] -autodoc_default_flags = ["members", "inherited-members"] +autodoc_default_flags = ["members", "no-undoc-members"] autodoc_member_order = "groupwise" autosummary_generate = True numpydoc_show_class_members = False diff --git a/doc/source/advanced/architecture.rst b/doc/source/advanced/architecture.rst index f257cb34..0b2c51f4 100644 --- a/doc/source/advanced/architecture.rst +++ b/doc/source/advanced/architecture.rst @@ -80,4 +80,4 @@ Number of Dimensions Number of Measures Mark Type Executor ---------- The data executor populates each Vis with a subset of the dataframe based on the specified intent. -You can learn more about executors in Lux `here `_. \ No newline at end of file +You can learn more about executors in Lux `here `_. \ No newline at end of file diff --git a/doc/source/advanced/date.rst b/doc/source/advanced/date.rst index 6adf4028..901ecf84 100644 --- a/doc/source/advanced/date.rst +++ b/doc/source/advanced/date.rst @@ -98,7 +98,7 @@ Below we look at an example stocks dataset that also has `date` field with each .. code-block:: python - df = pd.read_csv("../../lux/data/stocks.csv") + df = pd.read_csv("https://github.com/lux-org/lux-datasets/blob/master/data/stocks.csv?raw=true") df.dtypes diff --git a/doc/source/advanced/interestingness.rst b/doc/source/advanced/interestingness.rst index 0827ab65..8581a8ea 100644 --- a/doc/source/advanced/interestingness.rst +++ b/doc/source/advanced/interestingness.rst @@ -1,24 +1,24 @@ -********************** +******************************* Interestingness Scoring -********************** +******************************* In Lux, recommended visualizations are scored and ranked based on their statistical properties. Lux uses various standard metrics for determining how interesting a visualization is. The choice of an interestingness metric is dependent on the chart type, as shown in the following table. -+----------------+---------+------------------------------------------------------------------+ -| Chart Type | Filter? | Function | -+================+=========+==================================================================+ -| Bar/Line Chart | ✔ | :func:`lux.interestingness.interestingness.unevenness` | -| +---------+------------------------------------------------------------------+ ++----------------+---------+--------------------------------------------------------------------+ +| Chart Type | Filter? | Function | ++================+=========+====================================================================+ +| Bar/Line Chart | ✔ | :func:`lux.interestingness.interestingness.unevenness` | +| +---------+--------------------------------------------------------------------+ | | X | :func:`lux.interestingness.interestingness.deviation_from_overall` | -+----------------+---------+------------------------------------------------------------------+ -| Histogram | ✔ | :func:`lux.interestingness.interestingness.skewness` | -| +---------+------------------------------------------------------------------+ ++----------------+---------+--------------------------------------------------------------------+ +| Histogram | ✔ | :func:`lux.interestingness.interestingness.skewness` | +| +---------+--------------------------------------------------------------------+ | | X | :func:`lux.interestingness.interestingness.deviation_from_overall` | -+----------------+---------+------------------------------------------------------------------+ -| Scatterplot | ✔/X | :func:`lux.interestingness.interestingness.monotonicity` | -+----------------+---------+------------------------------------------------------------------+ ++----------------+---------+--------------------------------------------------------------------+ +| Scatterplot | ✔/X | :func:`lux.interestingness.interestingness.monotonicity` | ++----------------+---------+--------------------------------------------------------------------+ Bar Chart Interestingness ========================= @@ -30,7 +30,7 @@ Bar charts without filters: Unevenness A chart is scored higher if it is more uneven, indicating high variation in the individual bar values in the chart. The score is computed based -on the difference between the value of the bar chart .. math::`V` and the flat uniform distribution .. math::`V_{flat}`. +on the difference between the value of the bar chart :math:`V` and the flat uniform distribution :math:`V_{flat}`. The difference is captured via the Euclidean distance (L2 norm). @@ -42,6 +42,7 @@ The difference is captured via the Euclidean distance (L2 norm). .. Example: "Occurrence" recommendation .. _barWithFilter: + Bar charts with filters: Deviation from Overall ----------------------------------------------- @@ -77,6 +78,7 @@ The skewness is computed based on `scipy.stats.skew `_] [`Binder `_] +.. note:: You can follow along this tutorial in a Jupyter notebook. [`Github `_] [`Binder `_] This tutorial provides an overview of how you can use Lux in your data exploration workflow. @@ -25,8 +25,7 @@ Lux preserves the Pandas dataframe semantics -- which means that you can apply a df = pd.read_csv("lux/data/college.csv") -Lux is built on the philosophy that generating useful visualizations should be as simple as printing out a dataframe. -When you print out the dataframe in the notebook, you should see the default Pandas table display with an additional Toggle button. +To visualize your dataframe in Lux, simply print out the dataframe. You should see the default Pandas table display with an additional toggle button. .. code-block:: python @@ -37,7 +36,7 @@ When you print out the dataframe in the notebook, you should see the default Pan :align: center :alt: click on toggle, scroll on Correlation -By clicking on the Toggle button, you can now explore the data visually through Lux. You should see three tabs of visualizations recommended to you. +By clicking on the Toggle button, you can now explore the data visually through Lux. You should see several categories of visualizations recommended to you by browsing through the different tabs. .. image:: ../../../../lux-resources/doc_img/overview-2.gif :width: 700 @@ -75,7 +74,7 @@ As shown in the example above, by default, we display three types of actions sho :alt: Example of even and uneven category distributions -Refer to :doc:`this page <../advanced/action>` for details on different types of action in Lux. +Refer to :doc:`this page <../reference/lux.action>` for details on different types of action in Lux. Expressing Analysis Interest and Goals with User `Intent` ---------------------------------------------------------- @@ -111,7 +110,7 @@ You can specify a variety of things that you might be interested in, for example df.intent = ["MedianEarnings", "FundingModel=Public"] df -For more advance use of intent, refer to :doc:`this page <../getting_started/intent>` on how to specify the intent. +For more advance use of intent, refer to :doc:`this page <../guide/intent>` on how to specify the intent. Steering Recommendations via User Intent ---------------------------------------- @@ -129,7 +128,7 @@ Given the updated intent, additional actions (Enhance and Filter) are generated. - {MedianEarnings, **AverageCost**} - {MedianEarnings, **AverageFacultySalary**}. -.. image:: https://github.com/lux-org/lux-resources/blob/master/doc_img/overview-4.png +.. image:: https://github.com/lux-org/lux-resources/blob/master/doc_img/overview-4.png?raw=true :width: 700 :align: center :alt: screenshot of Enhance @@ -140,10 +139,7 @@ Given the updated intent, additional actions (Enhance and Filter) are generated. - {MedianEarnings, **Region=Southeast**} - {MedianEarnings, **Region=Great Lakes**}. -.. image:: https://github.com/lux-org/lux-resources/blob/master/doc_img/overview-5.png +.. image:: https://github.com/lux-org/lux-resources/blob/master/doc_img/overview-5.png?raw=true :width: 700 :align: center :alt: screenshot of Filter - - -.. Lux is built on the principle that users should always be able to visualize and explore anything they specify, without having to think about how the visualization should look like. diff --git a/doc/source/guide/FAQ.rst b/doc/source/guide/FAQ.rst index 203f015c..c99d29ed 100644 --- a/doc/source/guide/FAQ.rst +++ b/doc/source/guide/FAQ.rst @@ -12,38 +12,38 @@ Note that you must perform :code:`import lux` before you load in or create the d What if my data is stored in a relational database? """""""""""""""""""""""""""""""""""""""""""""""""""""""" - Lux has `some limited support `_ for SQL (currently only tested for Postgres). We are actively working on extending Lux to databases. If you are interested in using this feature, please `contact us `_ for more information. + Lux has `some limited support `__ for SQL (currently only tested for Postgres). We are actively working on extending Lux to databases. If you are interested in using this feature, please `contact us `_ for more information. What do I do with date-related attributes in my dataset? """""""""""""""""""""""""""""""""""""""""""""""""""""""" - Lux supports a variety of temporal data types in Pandas. For more information on how to handle temporal data in Lux, refer to `the datetime guide `_. + Lux supports a variety of temporal data types in Pandas. For more information on how to handle temporal data in Lux, refer to `the datetime guide `__. How do I access all of the current recommendations shown in my widget? """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - The recommendations for Lux can be accessed via the :code:`recommendation` property of the dataframe (e.g., df.recommendation). + The recommendations for Lux can be accessed via the :code:`recommendation` property of the dataframe (e.g., :code:`df.recommendation`). How do I set the Lux widgets to show up on default? """""""""""""""""""""""""""""""""""""""""""""""""""""""" - By default, we show the Pandas display and users can use the toggle button to switch to the Lux display. The `default_display` property allows users to change the setting so that the Lux widget is set as the default view for future operations on the specified dataframe: + By default, we show the Pandas display and users can use the toggle button to switch to the Lux display. The :code:`default_display` property allows users to change the setting so that the Lux widget is set as the default view for future operations: .. code-block:: python - df.config.default_display = "lux" + lux.config.default_display = "lux" To switch back to Pandas as the default display: .. code-block:: python - df.config.default_display = "pandas" + lux.config.default_display = "pandas" I want to change the opacity of my chart, add title, change chart font size, etc. How do I modify chart settings? """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - To add custom plot settings to the recommendations, you can set the global :code:`plot_config` property. See `this tutorial `_ on how to configure chart properties. Lux currently only support chart modifications in Altair. + To add custom plot settings to the recommendations, you can set the :code:`lux.config.plot_config` property. See `this tutorial `__ on how to configure chart properties. Lux currently only support chart modifications in Altair. How do I change aggregation functions, binning, or axis channels to non-default values? """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" To change the aggregation function to be something that is not average or set an attribute to display on the x-axis instead of y-axis, you can override the default values in the :code:`lux.Clause` specification. - To override automatically inferred properties, you can specify additional arguements inside `lux.Clause` to set the value of the Clause properties. See `this page `_ for more details. + To override automatically inferred properties, you can specify additional arguements inside :py:class:`lux.vis.Clause` to set the value of the Clause properties. See `this page `__ for more details. I want to look at the default recommendations that were recommended to me, how can I get the dataframe to display those? """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -66,7 +66,7 @@ How do I turn off Lux? How do I disable sampling and have Lux visualize the full dataset? """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - Lux displays a warning saying "Large dataframe detected: Lux is only visualizing a random sample". If you would like to disable sampling, you can run: + When visualizing large datasets, Lux may display a warning stating "`Large dataframe detected: Lux is only visualizing a random sample`". If you would like to disable sampling, you can run: .. code-block:: python @@ -79,12 +79,12 @@ How do I disable sampling and have Lux visualize the full dataset? lux.config.sampling = False df = pd.read_csv("...") - If you want to fine-tune the sampling parameters, you can edit :code:`lux.config.sampling_start` and :code:`lux.config.sampling_cap`. See `this page `_ for more details. + If you want to fine-tune the sampling parameters, you can edit :code:`lux.config.sampling_start` and :code:`lux.config.sampling_cap`. See `this page `__ for more details. Troubleshooting Tips -------------------- -To troubleshoot your Lux installation, we recommend cloning `this repo `_ and using one of the `demo notebooks `_ to test out Lux. +To troubleshoot your Lux installation, we recommend cloning `this repo `__ and using one of the `demo notebooks `__ to test out Lux. The Lux Jupyter widget does not show up when I print a dataframe. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -96,9 +96,10 @@ The Lux Jupyter widget does not show up when I print a dataframe. - Validating: OK - If you are able to import lux successfully and you do not see the "Toggle button" when you print the dataframe, it may be possible that Lux is not compatible with your browser. Lux is compatible with Google Chrome, but have not been extensively tested on Safari or Firefox. - - If you recieve the error message :code:`A Jupyter widget could not be displayed because the widget state could not be found.` This could happen if the kernel storing the widget is no longer available, or if the widget state was not saved in the notebook. You may be able to create the widget by running the appropriate cells.`, you may want to restart the notebook and rerun the cell. + - If you recieve the error message :code:`A Jupyter widget could not be displayed because the widget state could not be found.` This could happen if the kernel storing the widget is no longer available, or if the widget state was not saved in the notebook. You may be able to create the widget by running the particular cell again. If this doesn't work, then you may want try restarting the notebook and rerun the cell. - If you receive the error message :code:`ModuleNotFoundError: No module named 'luxwidget'`, it is possible that your luxwidget and lux-api versions are not in sync. The latest version of lux-api requires luxwidget v0.1 or above. Try running the following code: - If you receive the error message :code:`PermissionError: [Errno 13] Permission denied.` during the execution of the command :code:`jupyter nbextension install --py luxwidget`, then you can add the flag :code:`--user` (:code:`jupyter nbextension enable --py --user luxwidget`). + - Alternatively, if none of the above works. You can try creating a fresh virtual environment and follow the `quick install instructions `_. .. code-block:: bash @@ -112,8 +113,6 @@ The Lux Jupyter widget does not show up when I print a dataframe. jupyter nbextension install --py luxwidget jupyter nbextension enable --py luxwidget - - Alternatively, you can also try creating a fresh virtual environment and follow the `quick install instructions `_. I'm not able to export my visualizations via the :code:`exported` property. @@ -140,7 +139,7 @@ I'm not able to export my visualizations via the :code:`exported` property. I have an issue that is not addressed by any of the FAQs. """""""""""""""""""""""""""""""""""""""""""""""""""""""""" -Please submit a `Github Issue `_ or ask a question on `Slack `_. +Please submit a `Github Issue `__ or ask a question on `Slack `__. .. Not Currently Supported .. - What do I do if I want to change the data type of an attribute? diff --git a/doc/source/guide/intent.rst b/doc/source/guide/intent.rst index eba6c287..0a1a8e59 100644 --- a/doc/source/guide/intent.rst +++ b/doc/source/guide/intent.rst @@ -107,8 +107,9 @@ Note that since there are three different visualizations that is generated based :alt: add screenshot You can specify to Lux that you are interested in learning more about colleges in New England. - In the resulting Filter action, we see that Lux suggests visualizations in other `Region`s as recommendations. - + + In the resulting Filter action, we see that Lux suggests visualizations in other `Region` as recommendations. + .. code-block:: python df.intent = ["Region=New England"] diff --git a/doc/source/guide/style.rst b/doc/source/guide/style.rst index 516f1e5a..58a0fa71 100644 --- a/doc/source/guide/style.rst +++ b/doc/source/guide/style.rst @@ -115,4 +115,6 @@ We want to decrease the opacity of scatterplots, but keep the opacity for the ot :width: 700 :align: center +.. note:: For now, if the visualization has already been rendered before, you will need to run `df.expire_recs()` to see the updated visualization. + We can modify the scatterplot setting, without changing the settings for the other chart types. diff --git a/doc/source/reference/API.rst b/doc/source/reference/API.rst index 68b31def..42659464 100644 --- a/doc/source/reference/API.rst +++ b/doc/source/reference/API.rst @@ -4,17 +4,35 @@ API **** +Core Lux Objects +----------------- + +.. autosummary:: + :toctree: gen + :nosignatures: + + lux.core.frame.LuxDataFrame + lux.core.series.LuxSeries + +Configuration Options +---------------------- + +.. autosummary:: + :toctree: gen + :nosignatures: + + lux._config.config.Config + Basic API Interface ------------------- .. autosummary:: :toctree: gen :nosignatures: - + lux.vis.Vis.Vis lux.vis.VisList.VisList lux.vis.Vis.Clause - lux.core.frame.LuxDataFrame Advanced Internals (Dev) ------------------------- diff --git a/doc/source/reference/config.rst b/doc/source/reference/config.rst index a1474dc5..7b85b687 100644 --- a/doc/source/reference/config.rst +++ b/doc/source/reference/config.rst @@ -2,23 +2,22 @@ Configuration Settings *********************** -In Lux, users can customize various global settings to configure the behavior of Lux through :py:mod:`lux.config.Config`. This page documents some of the configurations that you can apply in Lux. +In Lux, users can customize various global settings to configure the behavior of Lux through :py:class:`lux.config.Config`. This page documents some of the configurations that you can apply in Lux. Change the default display of Lux ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -We can set the `default_display` of the global class 'Config' to change the default form of output. In the following block, we set it to 'lux,' therefore the VisList will display first. +We can set the :code:`default_display` to change whether the Pandas table or Lux widget is displayed by default. In the following block, we set the default display to 'lux', therefore the Lux widget will display first. .. code-block:: python - lux.config.default_display = "lux" # Set Lux as default display + lux.config.default_display = "lux" df .. image:: https://github.com/lux-org/lux-resources/blob/master/doc_img/display-1.png?raw=true :width: 700 :align: center - :alt: Retrieves a single attribute from Lux's Action Manager using its defined id. We can set the default_display back to 'pandas,' which would allow for the dataframe object to display first. You can still toggle to Lux/Pandas respectively using the 'Toggle' button. @@ -30,7 +29,6 @@ We can set the default_display back to 'pandas,' which would allow for the dataf .. image:: https://github.com/lux-org/lux-resources/blob/master/doc_img/display-2.png?raw=true :width: 700 :align: center - :alt: Retrieves a single attribute from Lux's Action Manager using its defined id. If you try to set the default_display to anything other than 'lux' or 'pandas,' a warning will be shown, and the display will default to the previous setting. @@ -42,7 +40,6 @@ If you try to set the default_display to anything other than 'lux' or 'pandas,' .. image:: https://github.com/lux-org/lux-resources/blob/master/doc_img/display-3.png?raw=true :width: 700 :align: center - :alt: Retrieves a single attribute from Lux's Action Manager using its defined id. Change the sampling parameters of Lux ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -72,3 +69,42 @@ We can disable this feature and revert back to using a scatter plot by running t .. code-block:: python lux.config.heatmap = False + + +Default Renderer +~~~~~~~~~~~~~~~~~ + +Charts in Lux are rendered using `Altair `__. We are working on supporting plotting via `matplotlib `__ and other plotting libraries. + +To change the default renderer, run the following code block: + +.. code-block:: python + + lux.config.renderer = "matplotlib" + +Plot Configurations +~~~~~~~~~~~~~~~~~~~ + +Altair supports plot configurations to be applied on top of the generated graphs. To set a default plot configuration, first write a function that can take in a `chart` and returns a `chart`. For example: + +.. code-block:: python + + def change_color_add_title(chart): + chart = chart.configure_mark(color="green") # change mark color to green + chart.title = "Custom Title" # add title to chart + return chart + +Then, set the `plot_config` to this function so that this function is applied to every plot generated. + +.. code-block:: python + + lux.config.plot_config = change_color_add_title + +The above results in the following changes: + +.. image:: https://github.com/lux-org/lux-resources/blob/master/doc_img/style-2.png?raw=true + :width: 600 + :align: center + +See `this page `__ for more details. + diff --git a/doc/source/reference/gen/lux._config.config.Config.rst b/doc/source/reference/gen/lux._config.config.Config.rst new file mode 100644 index 00000000..0000b36f --- /dev/null +++ b/doc/source/reference/gen/lux._config.config.Config.rst @@ -0,0 +1,34 @@ +lux.\_config.config.Config +========================== + +.. currentmodule:: lux._config.config + +.. autoclass:: Config + + + .. automethod:: __init__ + + + .. rubric:: Methods + + .. autosummary:: + + ~Config.__init__ + ~Config.set_SQL_connection + ~Config.set_executor_type + + + + + + .. rubric:: Attributes + + .. autosummary:: + + ~Config.default_display + ~Config.heatmap + ~Config.sampling + ~Config.sampling_cap + ~Config.sampling_start + + \ No newline at end of file diff --git a/doc/source/reference/gen/lux.core.frame.LuxDataFrame.rst b/doc/source/reference/gen/lux.core.frame.LuxDataFrame.rst index 71259efb..600daf83 100644 --- a/doc/source/reference/gen/lux.core.frame.LuxDataFrame.rst +++ b/doc/source/reference/gen/lux.core.frame.LuxDataFrame.rst @@ -171,11 +171,11 @@ lux.core.frame.LuxDataFrame ~LuxDataFrame.rsub ~LuxDataFrame.rtruediv ~LuxDataFrame.sample + ~LuxDataFrame.save_as_html ~LuxDataFrame.select_dtypes ~LuxDataFrame.sem - ~LuxDataFrame.set_SQL_connection + ~LuxDataFrame.set_SQL_table ~LuxDataFrame.set_axis - ~LuxDataFrame.set_executor_type ~LuxDataFrame.set_index ~LuxDataFrame.set_intent ~LuxDataFrame.set_intent_as_vis diff --git a/doc/source/reference/gen/lux.core.series.LuxSeries.rst b/doc/source/reference/gen/lux.core.series.LuxSeries.rst new file mode 100644 index 00000000..0f50d3e4 --- /dev/null +++ b/doc/source/reference/gen/lux.core.series.LuxSeries.rst @@ -0,0 +1,234 @@ +lux.core.series.LuxSeries +========================= + +.. currentmodule:: lux.core.series + +.. autoclass:: LuxSeries + + + .. automethod:: __init__ + + + .. rubric:: Methods + + .. autosummary:: + + ~LuxSeries.__init__ + ~LuxSeries.abs + ~LuxSeries.add + ~LuxSeries.add_prefix + ~LuxSeries.add_suffix + ~LuxSeries.agg + ~LuxSeries.aggregate + ~LuxSeries.align + ~LuxSeries.all + ~LuxSeries.any + ~LuxSeries.append + ~LuxSeries.apply + ~LuxSeries.argmax + ~LuxSeries.argmin + ~LuxSeries.argsort + ~LuxSeries.asfreq + ~LuxSeries.asof + ~LuxSeries.astype + ~LuxSeries.at_time + ~LuxSeries.autocorr + ~LuxSeries.backfill + ~LuxSeries.between + ~LuxSeries.between_time + ~LuxSeries.bfill + ~LuxSeries.bool + ~LuxSeries.clip + ~LuxSeries.combine + ~LuxSeries.combine_first + ~LuxSeries.compare + ~LuxSeries.convert_dtypes + ~LuxSeries.copy + ~LuxSeries.corr + ~LuxSeries.count + ~LuxSeries.cov + ~LuxSeries.cummax + ~LuxSeries.cummin + ~LuxSeries.cumprod + ~LuxSeries.cumsum + ~LuxSeries.describe + ~LuxSeries.diff + ~LuxSeries.display_pandas + ~LuxSeries.div + ~LuxSeries.divide + ~LuxSeries.divmod + ~LuxSeries.dot + ~LuxSeries.drop + ~LuxSeries.drop_duplicates + ~LuxSeries.droplevel + ~LuxSeries.dropna + ~LuxSeries.duplicated + ~LuxSeries.eq + ~LuxSeries.equals + ~LuxSeries.ewm + ~LuxSeries.expanding + ~LuxSeries.explode + ~LuxSeries.factorize + ~LuxSeries.ffill + ~LuxSeries.fillna + ~LuxSeries.filter + ~LuxSeries.first + ~LuxSeries.first_valid_index + ~LuxSeries.floordiv + ~LuxSeries.ge + ~LuxSeries.get + ~LuxSeries.groupby + ~LuxSeries.gt + ~LuxSeries.head + ~LuxSeries.hist + ~LuxSeries.idxmax + ~LuxSeries.idxmin + ~LuxSeries.infer_objects + ~LuxSeries.interpolate + ~LuxSeries.isin + ~LuxSeries.isna + ~LuxSeries.isnull + ~LuxSeries.item + ~LuxSeries.items + ~LuxSeries.iteritems + ~LuxSeries.keys + ~LuxSeries.kurt + ~LuxSeries.kurtosis + ~LuxSeries.last + ~LuxSeries.last_valid_index + ~LuxSeries.le + ~LuxSeries.lt + ~LuxSeries.mad + ~LuxSeries.map + ~LuxSeries.mask + ~LuxSeries.max + ~LuxSeries.mean + ~LuxSeries.median + ~LuxSeries.memory_usage + ~LuxSeries.min + ~LuxSeries.mod + ~LuxSeries.mode + ~LuxSeries.mul + ~LuxSeries.multiply + ~LuxSeries.ne + ~LuxSeries.nlargest + ~LuxSeries.notna + ~LuxSeries.notnull + ~LuxSeries.nsmallest + ~LuxSeries.nunique + ~LuxSeries.pad + ~LuxSeries.pct_change + ~LuxSeries.pipe + ~LuxSeries.pop + ~LuxSeries.pow + ~LuxSeries.prod + ~LuxSeries.product + ~LuxSeries.quantile + ~LuxSeries.radd + ~LuxSeries.rank + ~LuxSeries.ravel + ~LuxSeries.rdiv + ~LuxSeries.rdivmod + ~LuxSeries.reindex + ~LuxSeries.reindex_like + ~LuxSeries.rename + ~LuxSeries.rename_axis + ~LuxSeries.reorder_levels + ~LuxSeries.repeat + ~LuxSeries.replace + ~LuxSeries.resample + ~LuxSeries.reset_index + ~LuxSeries.rfloordiv + ~LuxSeries.rmod + ~LuxSeries.rmul + ~LuxSeries.rolling + ~LuxSeries.round + ~LuxSeries.rpow + ~LuxSeries.rsub + ~LuxSeries.rtruediv + ~LuxSeries.sample + ~LuxSeries.searchsorted + ~LuxSeries.sem + ~LuxSeries.set_axis + ~LuxSeries.shift + ~LuxSeries.skew + ~LuxSeries.slice_shift + ~LuxSeries.sort_index + ~LuxSeries.sort_values + ~LuxSeries.squeeze + ~LuxSeries.std + ~LuxSeries.sub + ~LuxSeries.subtract + ~LuxSeries.sum + ~LuxSeries.swapaxes + ~LuxSeries.swaplevel + ~LuxSeries.tail + ~LuxSeries.take + ~LuxSeries.to_clipboard + ~LuxSeries.to_csv + ~LuxSeries.to_dict + ~LuxSeries.to_excel + ~LuxSeries.to_frame + ~LuxSeries.to_hdf + ~LuxSeries.to_json + ~LuxSeries.to_latex + ~LuxSeries.to_list + ~LuxSeries.to_markdown + ~LuxSeries.to_numpy + ~LuxSeries.to_pandas + ~LuxSeries.to_period + ~LuxSeries.to_pickle + ~LuxSeries.to_sql + ~LuxSeries.to_string + ~LuxSeries.to_timestamp + ~LuxSeries.to_xarray + ~LuxSeries.tolist + ~LuxSeries.transform + ~LuxSeries.transpose + ~LuxSeries.truediv + ~LuxSeries.truncate + ~LuxSeries.tshift + ~LuxSeries.tz_convert + ~LuxSeries.tz_localize + ~LuxSeries.unique + ~LuxSeries.unstack + ~LuxSeries.update + ~LuxSeries.value_counts + ~LuxSeries.var + ~LuxSeries.view + ~LuxSeries.where + ~LuxSeries.xs + + + + + + .. rubric:: Attributes + + .. autosummary:: + + ~LuxSeries.T + ~LuxSeries.array + ~LuxSeries.at + ~LuxSeries.attrs + ~LuxSeries.axes + ~LuxSeries.dtype + ~LuxSeries.dtypes + ~LuxSeries.empty + ~LuxSeries.hasnans + ~LuxSeries.iat + ~LuxSeries.iloc + ~LuxSeries.index + ~LuxSeries.is_monotonic + ~LuxSeries.is_monotonic_decreasing + ~LuxSeries.is_monotonic_increasing + ~LuxSeries.is_unique + ~LuxSeries.loc + ~LuxSeries.name + ~LuxSeries.nbytes + ~LuxSeries.ndim + ~LuxSeries.shape + ~LuxSeries.size + ~LuxSeries.values + + \ No newline at end of file diff --git a/doc/source/reference/gen/lux.executor.Executor.Executor.rst b/doc/source/reference/gen/lux.executor.Executor.Executor.rst index 71e7c0d2..c45473c6 100644 --- a/doc/source/reference/gen/lux.executor.Executor.Executor.rst +++ b/doc/source/reference/gen/lux.executor.Executor.Executor.rst @@ -15,12 +15,14 @@ lux.executor.Executor.Executor ~Executor.__init__ ~Executor.compute_data_model + ~Executor.compute_data_model_lookup ~Executor.compute_data_type ~Executor.compute_stats ~Executor.execute ~Executor.execute_aggregate ~Executor.execute_binning ~Executor.execute_filter + ~Executor.invert_data_type ~Executor.mapping ~Executor.reverseMapping diff --git a/doc/source/reference/gen/lux.executor.PandasExecutor.PandasExecutor.rst b/doc/source/reference/gen/lux.executor.PandasExecutor.PandasExecutor.rst index 83997a90..a65b633e 100644 --- a/doc/source/reference/gen/lux.executor.PandasExecutor.PandasExecutor.rst +++ b/doc/source/reference/gen/lux.executor.PandasExecutor.PandasExecutor.rst @@ -16,6 +16,7 @@ lux.executor.PandasExecutor.PandasExecutor ~PandasExecutor.__init__ ~PandasExecutor.apply_filter ~PandasExecutor.compute_data_model + ~PandasExecutor.compute_data_model_lookup ~PandasExecutor.compute_data_type ~PandasExecutor.compute_dataset_metadata ~PandasExecutor.compute_stats @@ -25,6 +26,7 @@ lux.executor.PandasExecutor.PandasExecutor ~PandasExecutor.execute_binning ~PandasExecutor.execute_filter ~PandasExecutor.execute_sampling + ~PandasExecutor.invert_data_type ~PandasExecutor.mapping ~PandasExecutor.reverseMapping diff --git a/doc/source/reference/gen/lux.executor.SQLExecutor.SQLExecutor.rst b/doc/source/reference/gen/lux.executor.SQLExecutor.SQLExecutor.rst index c6c3f631..f5ddf2ec 100644 --- a/doc/source/reference/gen/lux.executor.SQLExecutor.SQLExecutor.rst +++ b/doc/source/reference/gen/lux.executor.SQLExecutor.SQLExecutor.rst @@ -15,12 +15,14 @@ lux.executor.SQLExecutor.SQLExecutor ~SQLExecutor.__init__ ~SQLExecutor.compute_data_model + ~SQLExecutor.compute_data_model_lookup ~SQLExecutor.compute_data_type ~SQLExecutor.compute_stats ~SQLExecutor.execute ~SQLExecutor.execute_aggregate ~SQLExecutor.execute_binning ~SQLExecutor.execute_filter + ~SQLExecutor.invert_data_type ~SQLExecutor.mapping ~SQLExecutor.reverseMapping diff --git a/doc/source/reference/gen/lux.history.event.Event.rst b/doc/source/reference/gen/lux.history.event.Event.rst new file mode 100644 index 00000000..6674286a --- /dev/null +++ b/doc/source/reference/gen/lux.history.event.Event.rst @@ -0,0 +1,22 @@ +lux.history.event.Event +======================= + +.. currentmodule:: lux.history.event + +.. autoclass:: Event + + + .. automethod:: __init__ + + + .. rubric:: Methods + + .. autosummary:: + + ~Event.__init__ + + + + + + \ No newline at end of file diff --git a/doc/source/reference/gen/lux.history.history.Event.rst b/doc/source/reference/gen/lux.history.history.Event.rst new file mode 100644 index 00000000..2b03f4e3 --- /dev/null +++ b/doc/source/reference/gen/lux.history.history.Event.rst @@ -0,0 +1,22 @@ +lux.history.history.Event +========================= + +.. currentmodule:: lux.history.history + +.. autoclass:: Event + + + .. automethod:: __init__ + + + .. rubric:: Methods + + .. autosummary:: + + ~Event.__init__ + + + + + + \ No newline at end of file diff --git a/doc/source/reference/gen/lux.history.history.History.rst b/doc/source/reference/gen/lux.history.history.History.rst new file mode 100644 index 00000000..e10bd1af --- /dev/null +++ b/doc/source/reference/gen/lux.history.history.History.rst @@ -0,0 +1,23 @@ +lux.history.history.History +=========================== + +.. currentmodule:: lux.history.history + +.. autoclass:: History + + + .. automethod:: __init__ + + + .. rubric:: Methods + + .. autosummary:: + + ~History.__init__ + ~History.append_event + + + + + + \ No newline at end of file diff --git a/doc/source/reference/gen/lux.vis.Vis.Vis.rst b/doc/source/reference/gen/lux.vis.Vis.Vis.rst index 39e2983b..dc79967d 100644 --- a/doc/source/reference/gen/lux.vis.Vis.Vis.rst +++ b/doc/source/reference/gen/lux.vis.Vis.Vis.rst @@ -22,10 +22,10 @@ lux.vis.Vis.Vis ~Vis.refresh_source ~Vis.remove_column_from_spec ~Vis.remove_filter_from_spec - ~Vis.to_code ~Vis.set_intent ~Vis.to_Altair ~Vis.to_VegaLite + ~Vis.to_code diff --git a/doc/source/reference/lux._config.config.rst b/doc/source/reference/lux._config.config.rst new file mode 100644 index 00000000..73f977f0 --- /dev/null +++ b/doc/source/reference/lux._config.config.rst @@ -0,0 +1,9 @@ +lux.config.config package +=================================== + +lux._config.config.Config module +--------------------------------- + +.. automodule:: lux._config.config.config + :members: + diff --git a/doc/source/reference/lux.action.rst b/doc/source/reference/lux.action.rst index 52ff79fe..b29055ab 100644 --- a/doc/source/reference/lux.action.rst +++ b/doc/source/reference/lux.action.rst @@ -10,7 +10,7 @@ lux.action.column\_group module .. automodule:: lux.action.column_group :members: :undoc-members: - :show-inheritance: + lux.action.correlation module ----------------------------- @@ -18,7 +18,7 @@ lux.action.correlation module .. automodule:: lux.action.correlation :members: :undoc-members: - :show-inheritance: + lux.action.custom module ------------------------ @@ -26,7 +26,6 @@ lux.action.custom module .. automodule:: lux.action.custom :members: :undoc-members: - :show-inheritance: lux.action.enhance module ------------------------- @@ -34,7 +33,6 @@ lux.action.enhance module .. automodule:: lux.action.enhance :members: :undoc-members: - :show-inheritance: lux.action.filter module ------------------------ @@ -42,7 +40,6 @@ lux.action.filter module .. automodule:: lux.action.filter :members: :undoc-members: - :show-inheritance: lux.action.generalize module ---------------------------- @@ -50,7 +47,6 @@ lux.action.generalize module .. automodule:: lux.action.generalize :members: :undoc-members: - :show-inheritance: lux.action.row\_group module ---------------------------- @@ -58,15 +54,6 @@ lux.action.row\_group module .. automodule:: lux.action.row_group :members: :undoc-members: - :show-inheritance: - -lux.action.similarity module ----------------------------- - -.. automodule:: lux.action.similarity - :members: - :undoc-members: - :show-inheritance: lux.action.univariate module ---------------------------- @@ -74,7 +61,6 @@ lux.action.univariate module .. automodule:: lux.action.univariate :members: :undoc-members: - :show-inheritance: Module contents @@ -83,4 +69,3 @@ Module contents .. automodule:: lux.action :members: :undoc-members: - :show-inheritance: diff --git a/doc/source/reference/lux.core.rst b/doc/source/reference/lux.core.rst index 93a8e7bf..f1d40000 100644 --- a/doc/source/reference/lux.core.rst +++ b/doc/source/reference/lux.core.rst @@ -9,14 +9,13 @@ lux.core.frame module .. automodule:: lux.core.frame :members: - :undoc-members: - :show-inheritance: + :exclude-members: head, describe, info, tail + -Module contents ---------------- - -.. automodule:: lux.core +lux.core.series module +----------------------- + +.. automodule:: lux.core.series :members: - :undoc-members: - :show-inheritance: + diff --git a/doc/source/reference/lux.rst b/doc/source/reference/lux.rst index 472a6abd..52732221 100644 --- a/doc/source/reference/lux.rst +++ b/doc/source/reference/lux.rst @@ -22,4 +22,3 @@ Module contents .. automodule:: lux :members: :undoc-members: - :show-inheritance: diff --git a/doc/source/reference/lux.utils.rst b/doc/source/reference/lux.utils.rst index 965d9dd1..5a3177fb 100644 --- a/doc/source/reference/lux.utils.rst +++ b/doc/source/reference/lux.utils.rst @@ -12,14 +12,6 @@ lux.utils.date\_utils module :undoc-members: :show-inheritance: -lux.utils.renderjson module ---------------------------- - -.. automodule:: lux.utils.renderjson - :members: - :undoc-members: - :show-inheritance: - lux.utils.utils module ---------------------- diff --git a/lux/_config/config.py b/lux/_config/config.py index 21eace4f..7ee84d58 100644 --- a/lux/_config/config.py +++ b/lux/_config/config.py @@ -149,6 +149,10 @@ def is_callable(obj) -> bool: class Config: + """ + Class for Lux configurations applied globally across entire session + """ + def __init__(self): self._default_display = "pandas" self.renderer = "altair" @@ -162,6 +166,12 @@ def __init__(self): @property def sampling_cap(self): + """ + Parameters + ---------- + sample_number : int + Cap on the number of rows to sample. Must be larger than _sampling_start + """ return self._sampling_cap @sampling_cap.setter @@ -170,7 +180,7 @@ def sampling_cap(self, sample_number: int) -> None: Parameters ---------- sample_number : int - Cap on the number of rows to sample. Must be larger than _sampling_start + Cap on the number of rows to sample. Must be larger than _sampling_start """ if type(sample_number) == int: assert sample_number >= self._sampling_start @@ -183,6 +193,13 @@ def sampling_cap(self, sample_number: int) -> None: @property def sampling_start(self): + """ + Parameters + ---------- + sample_number : int + Number of rows required to begin sampling. Must be smaller or equal to _sampling_cap + + """ return self._sampling_start @sampling_start.setter @@ -191,7 +208,7 @@ def sampling_start(self, sample_number: int) -> None: Parameters ---------- sample_number : int - Number of rows required to begin sampling. Must be smaller or equal to _sampling_cap + Number of rows required to begin sampling. Must be smaller or equal to _sampling_cap """ if type(sample_number) == int: @@ -205,6 +222,12 @@ def sampling_start(self, sample_number: int) -> None: @property def sampling(self): + """ + Parameters + ---------- + sample_flag : bool + Whether or not sampling will occur. + """ return self._sampling_flag @sampling.setter @@ -213,7 +236,7 @@ def sampling(self, sample_flag: bool) -> None: Parameters ---------- sample_flag : bool - Whether or not sampling will occur. + Whether or not sampling will occur. """ if type(sample_flag) == bool: self._sampling_flag = sample_flag @@ -225,6 +248,12 @@ def sampling(self, sample_flag: bool) -> None: @property def heatmap(self): + """ + Parameters + ---------- + heatmap_flag : bool + Whether or not a heatmap will be used instead of a scatter plot. + """ return self._heatmap_flag @heatmap.setter @@ -233,7 +262,7 @@ def heatmap(self, heatmap_flag: bool) -> None: Parameters ---------- heatmap_flag : bool - Whether or not a heatmap will be used instead of a scatter plot. + Whether or not a heatmap will be used instead of a scatter plot. """ if type(heatmap_flag) == bool: self._heatmap_flag = heatmap_flag @@ -245,6 +274,13 @@ def heatmap(self, heatmap_flag: bool) -> None: @property def default_display(self): + """ + Set the widget display to show Pandas by default or Lux by default + Parameters + ---------- + type : str + Default display type, can take either the string `lux` or `pandas` (regardless of capitalization) + """ return self._default_display @default_display.setter @@ -254,7 +290,7 @@ def default_display(self, type: str) -> None: Parameters ---------- type : str - Default display type, can take either the string `lux` or `pandas` (regardless of capitalization) + Default display type, can take either the string `lux` or `pandas` (regardless of capitalization) """ if type.lower() == "lux": self._default_display = "lux" @@ -267,6 +303,13 @@ def default_display(self, type: str) -> None: ) def set_SQL_connection(self, connection): + """ + Sets SQL connection to a database + + Parameters: + connection : SQLAlchemy connectable, str, or sqlite3 connection + For more information, `see here `__ + """ self.SQLconnection = connection def set_executor_type(self, exe): @@ -287,9 +330,6 @@ def set_executor_type(self, exe): self.executor = PandasExecutor() - def set_SQL_connection(self, connection): - self.SQLconnection = connection - config = Config() diff --git a/lux/core/frame.py b/lux/core/frame.py index e4ed9e3e..376fa6a7 100644 --- a/lux/core/frame.py +++ b/lux/core/frame.py @@ -112,6 +112,9 @@ def maintain_metadata(self): self._metadata_fresh = True def expire_recs(self): + """ + Expires and resets all recommendations + """ self._recs_fresh = False self._recommendation = {} self.current_vis = None @@ -120,7 +123,9 @@ def expire_recs(self): self._sampled = None def expire_metadata(self): - # Set metadata as null + """ + Expire all saved metadata to trigger a recomputation the next time the data is required. + """ self._metadata_fresh = False self.data_type = None self.unique_values = None @@ -166,6 +171,19 @@ def _infer_structure(self): @property def intent(self): + """ + Main function to set the intent of the dataframe. + The intent input goes through the parser, so that the string inputs are parsed into a lux.Clause object. + + Parameters + ---------- + intent : List[str,Clause] + intent list, can be a mix of string shorthand or a lux.Clause object + + Notes + ----- + :doc:`../guide/intent` + """ return self._intent @intent.setter @@ -187,19 +205,6 @@ def clear_intent(self): self.expire_recs() def set_intent(self, intent: List[Union[str, Clause]]): - """ - Main function to set the intent of the dataframe. - The intent input goes through the parser, so that the string inputs are parsed into a lux.Clause object. - - Parameters - ---------- - intent : List[str,Clause] - intent list, can be a mix of string shorthand or a lux.Clause object - - Notes - ----- - :doc:`../guide/clause` - """ self.expire_recs() self._intent = intent self._parse_validate_compile_intent() @@ -226,11 +231,12 @@ def copy_intent(self): def set_intent_as_vis(self, vis: Vis): """ - Set intent of the dataframe as the Vis + Set intent of the dataframe based on the intent of a Vis Parameters ---------- vis : Vis + Input Vis object """ self.expire_recs() self._intent = vis._inferred_intent @@ -488,7 +494,9 @@ def exported(self) -> Union[Dict[str, VisList], VisList]: ----- Convert the _selectedVisIdxs dictionary into a programmable VisList Example _selectedVisIdxs : - {'Correlation': [0, 2], 'Occurrence': [1]} + + {'Correlation': [0, 2], 'Occurrence': [1]} + indicating the 0th and 2nd vis from the `Correlation` tab is selected, and the 1st vis from the `Occurrence` tab is selected. Returns @@ -680,27 +688,38 @@ def render_widget(self, renderer: str = "altair", input_current_vis=""): Generate a LuxWidget based on the LuxDataFrame Structure of widgetJSON: + { - 'current_vis': {}, - 'recommendation': [ - { - 'action': 'Correlation', - 'description': "some description", - 'vspec': [ - {Vega-Lite spec for vis 1}, - {Vega-Lite spec for vis 2}, - ... - ] - }, - ... repeat for other actions - ] + + 'current_vis': {}, + 'recommendation': [ + + { + + 'action': 'Correlation', + 'description': "some description", + 'vspec': [ + + {Vega-Lite spec for vis 1}, + {Vega-Lite spec for vis 2}, + ... + + ] + + }, + ... repeat for other actions + + ] + } + Parameters ---------- renderer : str, optional Choice of visualization rendering library, by default "altair" input_current_vis : lux.LuxDataFrame, optional User-specified current vis to override default Current Vis, by default + """ check_import_lux_widget() import luxwidget diff --git a/lux/core/series.py b/lux/core/series.py index aea13d0c..dd4c4b4e 100644 --- a/lux/core/series.py +++ b/lux/core/series.py @@ -19,6 +19,10 @@ class LuxSeries(pd.Series): + """ + A subclass of pd.Series that supports all 1-D Series operations + """ + _metadata = [ "_intent", "data_type", @@ -54,14 +58,18 @@ def f(*args, **kwargs): f._get_axis_number = super(LuxSeries, self)._get_axis_number return f - def to_pandas(self): + def to_pandas(self) -> pd.Series: + """ + Convert Lux Series to Pandas Series + + Returns + ------- + pd.Series + """ import lux.core return lux.core.originalSeries(self, copy=False) - def display_pandas(self): - return self.to_pandas() - def __repr__(self): from IPython.display import display from IPython.display import clear_output @@ -154,5 +162,5 @@ def on_button_clicked(b): stacklevel=2, ) warnings.warn(traceback.format_exc()) - display(self.display_pandas()) + display(self.to_pandas()) return ""