lux.core.frame.LuxDataFrame

class lux.core.frame.LuxDataFrame(*args, **kw)[source]

A subclass of pd.DataFrame that supports all dataframe operations while housing other variables and functions for generating visual recommendations.

__init__(*args, **kw)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(*args, **kw) Initialize self.
abs() Return a Series/DataFrame with absolute numeric value of each element.
add(other[, axis, level, fill_value]) Get Addition of dataframe and other, element-wise (binary operator add).
add_prefix(prefix) Prefix labels with string prefix.
add_suffix(suffix) Suffix labels with string suffix.
agg([func]) Aggregate using one or more operations over the specified axis.
aggregate([func]) Aggregate using one or more operations over the specified axis.
align(other, join, axis, level, copy[, …]) Align two objects on their axes with the specified join method.
all([axis, bool_only, skipna, level]) Return whether all elements are True, potentially over an axis.
any([axis, bool_only, skipna, level]) Return whether any element is True, potentially over an axis.
append(other, ignore_index, …) Append rows of other to the end of caller, returning a new object.
apply(func, str, List[Union[Callable, str]], …) Apply a function along an axis of the DataFrame.
applymap(func, na_action, **kwargs) Apply a function to a Dataframe elementwise.
asfreq(freq[, method, fill_value]) Convert time series to specified frequency.
asof(where[, subset]) Return the last row(s) without any NaNs before where.
assign(**kwargs) Assign new columns to a DataFrame.
astype(dtype, copy, errors) Cast a pandas object to a specified dtype dtype.
at_time(time, asof[, axis]) Select values at particular time of day (e.g., 9:30AM).
backfill(axis, inplace, limit[, downcast]) Synonym for DataFrame.fillna() with method='bfill'.
between_time(start_time, end_time, …[, axis]) Select values between particular times of the day (e.g., 9:00-9:30 AM).
bfill(axis, inplace, limit[, downcast]) Synonym for DataFrame.fillna() with method='bfill'.
bool() Return the bool of a single element Series or DataFrame.
boxplot([column, by, ax, fontsize, rot, …]) Make a box plot from DataFrame columns.
clear_intent()
clip([lower, upper]) Trim values at input threshold(s).
combine(other, func[, fill_value]) Perform column-wise combine with another DataFrame.
combine_first(other) Update null elements with value in the same location in other.
compare(other, align_axis, int] = 1, …) Compare to another DataFrame and show the differences.
compute_metadata() Compute dataset metadata and statistics
convert_dtypes(infer_objects, …) Convert columns to best possible dtypes using dtypes supporting pd.NA.
copy(deep) Make a copy of this object’s indices and data.
copy_intent()
corr(method, np.ndarray], float] =, min_periods) Compute pairwise correlation of columns, excluding NA/null values.
corrwith(other, axis, int] = 0[, drop, method]) Compute pairwise correlation.
count(axis, level, numeric_only) Count non-NA cells for each column or row.
cov(min_periods, ddof) Compute pairwise covariance of columns, excluding NA/null values.
cummax([axis, skipna]) Return cumulative maximum over a DataFrame or Series axis.
cummin([axis, skipna]) Return cumulative minimum over a DataFrame or Series axis.
cumprod([axis, skipna]) Return cumulative product over a DataFrame or Series axis.
cumsum([axis, skipna]) Return cumulative sum over a DataFrame or Series axis.
current_vis_to_JSON(vlist[, input_current_vis])
describe([percentiles, include, exclude, …]) Generate descriptive statistics.
diff(periods, axis, int] = 0) First discrete difference of element.
display_pandas()
div(other[, axis, level, fill_value]) Get Floating division of dataframe and other, element-wise (binary operator truediv).
divide(other[, axis, level, fill_value]) Get Floating division of dataframe and other, element-wise (binary operator truediv).
dot(other) Compute the matrix multiplication between the DataFrame and other.
drop([labels, index, columns]) Drop specified labels from rows or columns.
drop_duplicates(subset, keep, inplace, …) Return DataFrame with duplicate rows removed.
droplevel(level[, axis]) Return Series/DataFrame with requested index / column level(s) removed.
dropna(axis, int] = 0, how[, thresh, subset]) Remove missing values.
duplicated(subset, keep) Return boolean Series denoting duplicate rows.
eq(other[, axis, level]) Get Equal to of dataframe and other, element-wise (binary operator eq).
equals(other) Test whether two objects contain the same elements.
eval(expr, inplace, **kwargs) Evaluate a string describing operations on DataFrame columns.
ewm(com, span, halflife, alpha, min_periods, …) Provide exponential weighted (EW) functions.
expanding(min_periods, center, axis, method) Provide expanding transformations.
expire_metadata() Expire all saved metadata to trigger a recomputation the next time the data is required.
expire_recs() Expires and resets all recommendations
explode(column, Sequence[Hashable]], …) Transform each element of a list-like to a row, replicating index values.
ffill(axis, inplace, limit[, downcast]) Synonym for DataFrame.fillna() with method='ffill'.
fillna(value, method, axis, inplace[, …]) Fill NA/NaN values using the specified method.
filter([items, axis]) Subset the dataframe rows or columns according to the specified index labels.
first(offset) Select initial periods of time series data based on a date offset.
first_valid_index() Return index for first non-NA value or None, if no NA value is found.
floordiv(other[, axis, level, fill_value]) Get Integer division of dataframe and other, element-wise (binary operator floordiv).
from_dict(data, orient, dtype[, columns]) Construct DataFrame from dict of array-like or dicts.
from_records(data[, index, exclude, columns]) Convert structured or record ndarray to DataFrame.
ge(other[, axis, level]) Get Greater than or equal to of dataframe and other, element-wise (binary operator ge).
get(key[, default]) Get item from object for given key (ex: DataFrame column).
groupby(*args, **kwargs) Group DataFrame using a mapper or by a Series of columns.
gt(other[, axis, level]) Get Greater than of dataframe and other, element-wise (binary operator gt).
head(n) Return the first n rows.
hist(column[, by, ax]) Make a histogram of the DataFrame’s columns.
idxmax(axis, int] = 0, skipna) Return index of first occurrence of maximum over requested axis.
idxmin(axis, int] = 0, skipna) Return index of first occurrence of minimum over requested axis.
infer_objects() Attempt to infer better dtypes for object columns.
info(verbose, buf, max_cols, memory_usage, …) Print a concise summary of a DataFrame.
insert(loc, column, value, allow_duplicates) Insert column into DataFrame at specified location.
intent_to_JSON(intent)
intent_to_string(intent)
interpolate(method, axis, limit, inplace, …) Fill NaN values using an interpolation method.
isin(values) Whether each element in the DataFrame is contained in values.
isna() Detect missing values.
isnull() Detect missing values.
items() Iterate over (column name, Series) pairs.
iteritems() Iterate over (column name, Series) pairs.
iterrows() Iterate over DataFrame rows as (index, Series) pairs.
itertuples(index, name) Iterate over DataFrame rows as namedtuples.
join(other, on, how, lsuffix, rsuffix, sort) Join columns of another DataFrame.
keys() Get the ‘info axis’ (see Indexing for more).
kurt([axis, skipna, level, numeric_only]) Return unbiased kurtosis over requested axis.
kurtosis([axis, skipna, level, numeric_only]) Return unbiased kurtosis over requested axis.
last(offset) Select final periods of time series data based on a date offset.
last_valid_index() Return index for last non-NA value or None, if no NA value is found.
le(other[, axis, level]) Get Less than or equal to of dataframe and other, element-wise (binary operator le).
lookup(row_labels, Sequence[Hashable]]], …) Label-based “fancy indexing” function for DataFrame.
lt(other[, axis, level]) Get Less than of dataframe and other, element-wise (binary operator lt).
mad([axis, skipna, level]) Return the mean absolute deviation of the values over the requested axis.
maintain_metadata() Maintain dataset metadata and statistics (Compute only if needed)
maintain_recs([is_series])
mask(cond[, other, inplace, axis, level, …]) Replace values where the condition is True.
max([axis, skipna, level, numeric_only]) Return the maximum of the values over the requested axis.
mean([axis, skipna, level, numeric_only]) Return the mean of the values over the requested axis.
median([axis, skipna, level, numeric_only]) Return the median of the values over the requested axis.
melt([id_vars, value_vars, var_name, value_name]) Unpivot a DataFrame from wide to long format, optionally leaving identifiers set.
memory_usage(index, deep) Return the memory usage of each column in bytes.
merge(right, how, on, left_on, right_on, …) Merge DataFrame or named Series objects with a database-style join.
min([axis, skipna, level, numeric_only]) Return the minimum of the values over the requested axis.
mod(other[, axis, level, fill_value]) Get Modulo of dataframe and other, element-wise (binary operator mod).
mode(axis, int] = 0, numeric_only, dropna) Get the mode(s) of each element along the selected axis.
mul(other[, axis, level, fill_value]) Get Multiplication of dataframe and other, element-wise (binary operator mul).
multiply(other[, axis, level, fill_value]) Get Multiplication of dataframe and other, element-wise (binary operator mul).
ne(other[, axis, level]) Get Not equal to of dataframe and other, element-wise (binary operator ne).
nlargest(n, columns, keep) Return the first n rows ordered by columns in descending order.
notna() Detect existing (non-missing) values.
notnull() Detect existing (non-missing) values.
nsmallest(n, columns, keep) Return the first n rows ordered by columns in ascending order.
nunique(axis, int] = 0, dropna) Count number of distinct elements in specified axis.
pad(axis, inplace, limit[, downcast]) Synonym for DataFrame.fillna() with method='ffill'.
pct_change([periods, fill_method, limit, freq]) Percentage change between the current and a prior element.
pipe(func, T] | tuple[Callable[…, T], …) Apply func(self, *args, **kwargs).
pivot([index, columns, values]) Return reshaped DataFrame organized by given index / column values.
pivot_table([values, index, columns, …]) Create a spreadsheet-style pivot table as a DataFrame.
pop(item) Return item and drop from frame.
pow(other[, axis, level, fill_value]) Get Exponential power of dataframe and other, element-wise (binary operator pow).
prod([axis, skipna, level, numeric_only, …]) Return the product of the values over the requested axis.
product([axis, skipna, level, numeric_only, …]) Return the product of the values over the requested axis.
quantile([q]) Return values at the given quantile over requested axis.
query(expr, inplace, **kwargs) Query the columns of a DataFrame with a boolean expression.
radd(other[, axis, level, fill_value]) Get Addition of dataframe and other, element-wise (binary operator radd).
rank([axis]) Compute numerical data ranks (1 through n) along axis.
rdiv(other[, axis, level, fill_value]) Get Floating division of dataframe and other, element-wise (binary operator rtruediv).
rec_to_JSON(recs)
reindex([labels, index, columns, axis, …]) Conform Series/DataFrame to new index with optional filling logic.
reindex_like(other, method, copy[, limit, …]) Return an object with matching indices as other object.
remove_deleted_recs(change)
rename([mapper, index, columns, axis, copy, …]) Alter axes labels.
rename_axis([mapper, index, columns, axis, …]) Set the name of the axis for the index or columns.
render_widget(renderer[, input_current_vis]) Generate a LuxWidget based on the LuxDataFrame
reorder_levels(order, int]], axis, int] = 0) Rearrange index levels using input order.
replace([to_replace, value, limit]) Replace values given in to_replace with value.
resample(rule[, axis, loffset, on, level]) Resample time-series data.
reset_index(level, drop, inplace, col_level, …) Reset the index, or a level of it.
rfloordiv(other[, axis, level, fill_value]) Get Integer division of dataframe and other, element-wise (binary operator rfloordiv).
rmod(other[, axis, level, fill_value]) Get Modulo of dataframe and other, element-wise (binary operator rmod).
rmul(other[, axis, level, fill_value]) Get Multiplication of dataframe and other, element-wise (binary operator rmul).
rolling(window, min_periods, center, …) Provide rolling window calculations.
round(decimals, int] | Series = 0, *args, …) Round a DataFrame to a variable number of decimal places.
rpow(other[, axis, level, fill_value]) Get Exponential power of dataframe and other, element-wise (binary operator rpow).
rsub(other[, axis, level, fill_value]) Get Subtraction of dataframe and other, element-wise (binary operator rsub).
rtruediv(other[, axis, level, fill_value]) Get Floating division of dataframe and other, element-wise (binary operator rtruediv).
sample([n, weights, random_state]) Return a random sample of items from an axis of object.
save_as_html(filename[, output]) Save dataframe widget as static HTML file
select_dtypes([include, exclude]) Return a subset of the DataFrame’s columns based on the column dtypes.
sem([axis, skipna, level, ddof, numeric_only]) Return unbiased standard error of the mean over requested axis.
set_axis(labels, axis, int] = 0, inplace) Assign desired index to given axis.
set_data_type(types) Set the data type for a particular attribute in the dataframe overriding the automatically-detected type inferred by Lux
set_flags(*, copy, allows_duplicate_labels) Return a new object with updated flags.
set_index(keys, drop, append, inplace, …) Set the DataFrame index using existing columns.
set_intent(intent, lux.vis.Clause.Clause]])
set_intent_as_vis(vis) Set intent of the dataframe based on the intent of a Vis
set_intent_on_click(change)
shift([periods, fill_value]) Shift index by desired number of periods with an optional time freq.
show_all_column_vis()
skew([axis, skipna, level, numeric_only]) Return unbiased skew over requested axis.
slice_shift(periods[, axis]) Equivalent to shift without copying data.
sort_index(axis, level, ascending, inplace, …) Sort object by labels (along an axis).
sort_values(by, axis, int] = 0[, ascending]) Sort by the values along either axis.
squeeze([axis]) Squeeze 1 dimensional axis objects into scalars.
stack(level, int] = -1, dropna) Stack the prescribed level(s) from columns to index.
std([axis, skipna, level, ddof, numeric_only]) Return sample standard deviation over requested axis.
sub(other[, axis, level, fill_value]) Get Subtraction of dataframe and other, element-wise (binary operator sub).
subtract(other[, axis, level, fill_value]) Get Subtraction of dataframe and other, element-wise (binary operator sub).
sum([axis, skipna, level, numeric_only, …]) Return the sum of the values over the requested axis.
swapaxes(axis1, axis2[, copy]) Interchange axes and swap values axes appropriately.
swaplevel(i, int] = -2, j, int] = -1, axis, …) Swap levels i and j in a MultiIndex.
tail(n) Return the last n rows.
take(indices[, axis]) Return the elements in the given positional indices along an axis.
to_JSON(rec_infolist[, input_current_vis])
to_clipboard(excel, sep, **kwargs) Copy object to the system clipboard.
to_csv(path_or_buf, sep, na_rep, …) Write object to a comma-separated values (csv) file.
to_dict(orient[, into]) Convert the DataFrame to a dictionary.
to_excel(excel_writer, sheet_name, na_rep, …) Write object to an Excel sheet.
to_feather(path, str, IO[AnyStr], …) Write a DataFrame to the binary Feather format.
to_gbq(destination_table, project_id, …[, …]) Write a DataFrame to a Google BigQuery table.
to_hdf(path_or_buf, key, mode, complevel, …) Write the contained data to an HDF5 file using HDFStore.
to_html(buf, columns, col_space, header, …) Render a DataFrame as an HTML table.
to_json(path_or_buf, orient, date_format, …) Convert the object to a JSON string.
to_latex([buf, columns, col_space, header, …]) Render object to a LaTeX tabular, longtable, or nested table/tabular.
to_markdown(buf, mode, index, …) Print DataFrame in Markdown-friendly format.
to_numpy(dtype, copy[, na_value]) Convert the DataFrame to a NumPy array.
to_pandas()
to_parquet(path, engine, compression, index, …) Write a DataFrame to the binary parquet format.
to_period(freq, axis, copy) Convert DataFrame from DatetimeIndex to PeriodIndex.
to_pickle(path, compression, Dict[str, Any], …) Pickle (serialize) object to file.
to_records([index, column_dtypes, index_dtypes]) Convert DataFrame to a NumPy record array.
to_sql(name, con[, schema, index_label, …]) Write records stored in a DataFrame to a SQL database.
to_stata(path, convert_dates, …) Export DataFrame object to Stata dta format.
to_string(buf, columns, col_space, header, …) Render a DataFrame to a console-friendly tabular output.
to_timestamp(freq, how, axis, copy) Cast to DatetimeIndex of timestamps, at beginning of period.
to_xarray() Return an xarray object from the pandas object.
transform(func, str, List[Union[Callable, …) Call func on self producing a DataFrame with transformed values.
transpose(*args, copy) Transpose index and columns.
truediv(other[, axis, level, fill_value]) Get Floating division of dataframe and other, element-wise (binary operator truediv).
truncate([before, after, axis]) Truncate a Series or DataFrame before and after some index value.
tshift(periods[, freq]) Shift the time index, using the index’s frequency if available.
tz_convert(tz[, axis, level]) Convert tz-aware axis to target time zone.
tz_localize(tz[, axis, level, ambiguous]) Localize tz-naive index of a Series or DataFrame to target time zone.
unstack(level, int] = -1[, fill_value]) Pivot a level of the (necessarily hierarchical) index labels.
update(other, join, overwrite[, filter_func]) Modify in place using non-NA values from another DataFrame.
value_counts(subset, normalize, sort, …) Return a Series containing counts of unique rows in the DataFrame.
var([axis, skipna, level, ddof, numeric_only]) Return unbiased variance over requested axis.
where(cond[, other, inplace, axis, level, …]) Replace values where the condition is False.
xs(key[, axis, level]) Return cross-section from the Series/DataFrame.

Attributes

T
at Access a single value for a row/column label pair.
attrs Dictionary of global attributes of this dataset.
axes Return a list representing the axes of the DataFrame.
columns The column labels of the DataFrame.
current_vis
data_type
dtypes Return the dtypes in the DataFrame.
empty Indicator whether DataFrame is empty.
exported Get selected visualizations as exported Vis List
flags Get the properties associated with this pandas object.
history
iat Access a single value for a row/column pair by integer position.
iloc Purely integer-location based indexing for selection by position.
index The index (row labels) of the DataFrame.
intent Main function to set the intent of the dataframe.
loc Access a group of rows and columns by label(s) or a boolean array.
ndim Return an int representing the number of axes / array dimensions.
recommendation
shape Return a tuple representing the dimensionality of the DataFrame.
size Return an int representing the number of elements in this object.
style Returns a Styler object.
values Return a Numpy representation of the DataFrame.
widget
compute_metadata() → None[source]

Compute dataset metadata and statistics

expire_metadata() → None[source]

Expire all saved metadata to trigger a recomputation the next time the data is required.

expire_recs() → None[source]

Expires and resets all recommendations

groupby(*args, **kwargs)[source]

Group DataFrame using a mapper or by a Series of columns.

A groupby operation involves some combination of splitting the object, applying a function, and combining the results. This can be used to group large amounts of data and compute operations on these groups.

Parameters:
  • by (mapping, function, label, or list of labels) – Used to determine the groups for the groupby. If by is a function, it’s called on each value of the object’s index. If a dict or Series is passed, the Series or dict VALUES will be used to determine the groups (the Series’ values are first aligned; see .align() method). If an ndarray is passed, the values are used as-is to determine the groups. A label or list of labels may be passed to group by the columns in self. Notice that a tuple is interpreted as a (single) key.
  • axis ({0 or 'index', 1 or 'columns'}, default 0) – Split along rows (0) or columns (1).
  • level (int, level name, or sequence of such, default None) – If the axis is a MultiIndex (hierarchical), group by a particular level or levels.
  • as_index (bool, default True) – For aggregated output, return object with group labels as the index. Only relevant for DataFrame input. as_index=False is effectively “SQL-style” grouped output.
  • sort (bool, default True) – Sort group keys. Get better performance by turning this off. Note this does not influence the order of observations within each group. Groupby preserves the order of rows within each group.
  • group_keys (bool, default True) – When calling apply, add group keys to index to identify pieces.
  • squeeze (bool, default False) –

    Reduce the dimensionality of the return type if possible, otherwise return a consistent type.

    Deprecated since version 1.1.0.

  • observed (bool, default False) – This only applies if any of the groupers are Categoricals. If True: only show observed values for categorical groupers. If False: show all values for categorical groupers.
  • dropna (bool, default True) –

    If True, and if group keys contain NA values, NA values together with row/column will be dropped. If False, NA values will also be treated as the key in groups

    New in version 1.1.0.

Returns:

Returns a groupby object that contains information about the groups.

Return type:

DataFrameGroupBy

See also

resample()
Convenience method for frequency conversion and resampling of time series.

Notes

See the user guide for more.

Examples

>>> df = pd.DataFrame({'Animal': ['Falcon', 'Falcon',
...                               'Parrot', 'Parrot'],
...                    'Max Speed': [380., 370., 24., 26.]})
>>> df
   Animal  Max Speed
0  Falcon      380.0
1  Falcon      370.0
2  Parrot       24.0
3  Parrot       26.0
>>> df.groupby(['Animal']).mean()
        Max Speed
Animal
Falcon      375.0
Parrot       25.0

Hierarchical Indexes

We can groupby different levels of a hierarchical index using the level parameter:

>>> arrays = [['Falcon', 'Falcon', 'Parrot', 'Parrot'],
...           ['Captive', 'Wild', 'Captive', 'Wild']]
>>> index = pd.MultiIndex.from_arrays(arrays, names=('Animal', 'Type'))
>>> df = pd.DataFrame({'Max Speed': [390., 350., 30., 20.]},
...                   index=index)
>>> df
                Max Speed
Animal Type
Falcon Captive      390.0
       Wild         350.0
Parrot Captive       30.0
       Wild          20.0
>>> df.groupby(level=0).mean()
        Max Speed
Animal
Falcon      370.0
Parrot       25.0
>>> df.groupby(level="Type").mean()
         Max Speed
Type
Captive      210.0
Wild         185.0

We can also choose to include NA in group keys or not by setting dropna parameter, the default setting is True:

>>> l = [[1, 2, 3], [1, None, 4], [2, 1, 3], [1, 2, 2]]
>>> df = pd.DataFrame(l, columns=["a", "b", "c"])
>>> df.groupby(by=["b"]).sum()
    a   c
b
1.0 2   3
2.0 2   5
>>> df.groupby(by=["b"], dropna=False).sum()
    a   c
b
1.0 2   3
2.0 2   5
NaN 1   4
>>> l = [["a", 12, 12], [None, 12.3, 33.], ["b", 12.3, 123], ["a", 1, 1]]
>>> df = pd.DataFrame(l, columns=["a", "b", "c"])
>>> df.groupby(by="a").sum()
    b     c
a
a   13.0   13.0
b   12.3  123.0
>>> df.groupby(by="a", dropna=False).sum()
    b     c
a
a   13.0   13.0
b   12.3  123.0
NaN 12.3   33.0
head(n: int = 5)[source]

Return the first n rows.

This function returns the first n rows for the object based on position. It is useful for quickly testing if your object has the right type of data in it.

For negative values of n, this function returns all rows except the last n rows, equivalent to df[:-n].

Parameters:n (int, default 5) – Number of rows to select.
Returns:The first n rows of the caller object.
Return type:same type as caller

See also

DataFrame.tail()
Returns the last n rows.

Examples

>>> df = pd.DataFrame({'animal': ['alligator', 'bee', 'falcon', 'lion',
...                    'monkey', 'parrot', 'shark', 'whale', 'zebra']})
>>> df
      animal
0  alligator
1        bee
2     falcon
3       lion
4     monkey
5     parrot
6      shark
7      whale
8      zebra

Viewing the first 5 lines

>>> df.head()
      animal
0  alligator
1        bee
2     falcon
3       lion
4     monkey

Viewing the first n lines (three in this case)

>>> df.head(3)
      animal
0  alligator
1        bee
2     falcon

For negative values of n

>>> df.head(-3)
      animal
0  alligator
1        bee
2     falcon
3       lion
4     monkey
5     parrot
maintain_metadata()[source]

Maintain dataset metadata and statistics (Compute only if needed)

render_widget(renderer: str = 'altair', input_current_vis='')[source]

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

]

}

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
save_as_html(filename: str = 'export.html', output=False)[source]

Save dataframe widget as static HTML file

Parameters:filename (str) – Filename for the output HTML file
set_data_type(types: dict)[source]

Set the data type for a particular attribute in the dataframe overriding the automatically-detected type inferred by Lux

Parameters:types (dict) – Dictionary that maps attribute/column name to a specified Lux Type. Possible options: “nominal”, “quantitative”, “id”, and “temporal”.

Example

df = pd.read_csv(”https://raw.githubusercontent.com/lux-org/lux-datasets/master/data/absenteeism.csv”) df.set_data_type({“ID”:”id”,

“Reason for absence”:”nominal”})
set_intent_as_vis(vis: lux.vis.Vis.Vis)[source]

Set intent of the dataframe based on the intent of a Vis

Parameters:vis (Vis) – Input Vis object
tail(n: int = 5)[source]

Return the last n rows.

This function returns last n rows from the object based on position. It is useful for quickly verifying data, for example, after sorting or appending rows.

For negative values of n, this function returns all rows except the first n rows, equivalent to df[n:].

Parameters:n (int, default 5) – Number of rows to select.
Returns:The last n rows of the caller object.
Return type:type of caller

See also

DataFrame.head()
The first n rows of the caller object.

Examples

>>> df = pd.DataFrame({'animal': ['alligator', 'bee', 'falcon', 'lion',
...                    'monkey', 'parrot', 'shark', 'whale', 'zebra']})
>>> df
      animal
0  alligator
1        bee
2     falcon
3       lion
4     monkey
5     parrot
6      shark
7      whale
8      zebra

Viewing the last 5 lines

>>> df.tail()
   animal
4  monkey
5  parrot
6   shark
7   whale
8   zebra

Viewing the last n lines (three in this case)

>>> df.tail(3)
  animal
6  shark
7  whale
8  zebra

For negative values of n

>>> df.tail(-3)
   animal
3    lion
4  monkey
5  parrot
6   shark
7   whale
8   zebra
exported

Get selected visualizations as exported Vis List

Notes

Convert the _selectedVisIdxs dictionary into a programmable VisList Example _selectedVisIdxs :

{‘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:When there are no exported vis, return empty list -> [] When all the exported vis is from the same tab, return a VisList of selected visualizations. -> VisList(v1, v2…) When the exported vis is from the different tabs, return a dictionary with the action name as key and selected visualizations in the VisList. -> {“Enhance”: VisList(v1, v2…), “Filter”: VisList(v5, v7…), ..}
Return type:Union[Dict[str,VisList], VisList]
intent

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

../guide/intent