lux.executor.PandasExecutor.PandasExecutor¶
-
class
lux.executor.PandasExecutor.
PandasExecutor
[source]¶ Given a Vis objects with complete specifications, fetch and process data using Pandas dataframe operations.
Methods
__init__
()Initialize self. apply_filter
(df, attribute, op, val)Helper function for applying filter to a dataframe compute_data_model
(data_type)compute_data_model_lookup
(data_type)compute_data_type
(ldf)compute_dataset_metadata
(ldf)compute_stats
(ldf)execute
(vislist, ldf[, approx])Given a VisList, fetch the data required to render the vis. execute_2D_binning
(vis)Apply 2D binning (heatmap) to vis.data execute_aggregate
(vis[, isFiltered])Aggregate data points on an axis for bar or line charts execute_approx_sample
(ldf)Compute and cache an approximate sample of the overall dataframe for the purpose of early pruning of the visualization search space execute_binning
(ldf, vis)Binning of data points for generating histograms execute_filter
(vis)Apply a Vis’s filter to vis.data execute_sampling
(ldf)Compute and cache a sample for the overall dataframe invert_data_type
(data_type)mapping
(rmap)reverseMapping
(map)-
static
apply_filter
(df: lux.core.frame.LuxDataFrame, attribute: str, op: str, val: object) → lux.core.frame.LuxDataFrame[source]¶ Helper function for applying filter to a dataframe
Parameters: - df (pandas.DataFrame) – Dataframe to filter on
- attribute (str) – Filter attribute
- op (str) – Filter operation, ‘=’, ‘<’, ‘>’, ‘<=’, ‘>=’, ‘!=’
- val (object) – Filter value
Returns: df – Dataframe resulting from the filter operation
Return type: pandas.DataFrame
-
static
execute
(vislist: lux.vis.VisList.VisList, ldf: lux.core.frame.LuxDataFrame, approx=False)[source]¶ Given a VisList, fetch the data required to render the vis. 1) Apply filters 2) Retrieve relevant attribute 3) Perform vis-related processing (aggregation, binning) 4) return a DataFrame with relevant results
Parameters: - vislist (list[lux.Vis]) – vis list that contains lux.Vis objects for visualization.
- ldf (lux.core.frame) – LuxDataFrame with specified intent.
Returns: Return type: None
-
static
execute_2D_binning
(vis: lux.vis.Vis.Vis) → None[source]¶ Apply 2D binning (heatmap) to vis.data
Parameters: vis (Vis) –
-
static
execute_aggregate
(vis: lux.vis.Vis.Vis, isFiltered=True)[source]¶ Aggregate data points on an axis for bar or line charts
Parameters: - vis (lux.Vis) – lux.Vis object that represents a visualization
- ldf (lux.core.frame) – LuxDataFrame with specified intent.
Returns: Return type: None
-
static
execute_approx_sample
(ldf: lux.core.frame.LuxDataFrame)[source]¶ Compute and cache an approximate sample of the overall dataframe for the purpose of early pruning of the visualization search space
Parameters: ldf (LuxDataFrame) –
-
static
execute_binning
(ldf: lux.core.frame.LuxDataFrame, vis: lux.vis.Vis.Vis)[source]¶ Binning of data points for generating histograms
Parameters: - vis (lux.Vis) – lux.Vis object that represents a visualization
- ldf (lux.core.frame) – LuxDataFrame with specified intent.
Returns: Return type: None
-
static
execute_filter
(vis: lux.vis.Vis.Vis) → bool[source]¶ Apply a Vis’s filter to vis.data
Parameters: vis (Vis) – Returns: Boolean flag indicating if any filter was applied Return type: bool
-
static
execute_sampling
(ldf: lux.core.frame.LuxDataFrame)[source]¶ Compute and cache a sample for the overall dataframe
- When # of rows exceeds lux.config.sampling_start, take 75% df as sample
- When # of rows exceeds lux.config.sampling_cap, cap the df at {lux.config.sampling_cap} rows
lux.config.sampling_start = 100k rows lux.config.sampling_cap = 1M rows
Parameters: ldf (LuxDataFrame) –
-
static