Tools for use in Mode Analytics Jupyter Notebooks
Project description
ssmode
Installing & Importing
To use the helper functions in a Mode Python Notebook, first install the package by adding this cell:
pip install ssmode -t "/tmp" > /dev/null 2>&1
You can then import various functions like:
from ssmode.tables import style_table
Styling Documentation
The functions in files bar_chart.py
, kpi.py
, tables.py
are designed to "fake" the Mode Analytics built-in widgets from the Notebook.
Styling Tables
style_table(df, hl_type=None, n=3, bar_cols=[])
df
: Pandas Dataframe (index will not be displayed)hl_type
:None
or string'nlargest'
,'gradient'
or'bars'
specifying cell highlighting typen
: integer > 0 specifying how many greatest cells will be highlighted (only applicable forhl_type='nlargest'
), all numeric columns will get this stylebar_cols
: array of strings specifying which columns will get the "bar charty style" (only applicable forhl_type='bars'
)
Styling Bar & Line Charts
style_bar_chart(ptl_fig, ytitle='')
OR style_line_chart(ptl_fig, ytitle='')
ptl_fig
: plotly chart with barsytitle
: title on y-axis
Displaying KPI Widget
display_as_kpi(kpi_name, value)
kpi_name
: string specifying KPI title/name (displayed on top)value
: value of the KPI (large value)
Processing Functions Documentation
Outlier Removal
prune_quotes(df, variable_col, group_cols, log_scale=True, k=1.5, max_diffs=[(2,3),(3,5),(4,10)])
df
: Pandas Dataframe with data to remove outliers fromvariable_col
: string with column name based on which outliers will be removed (e.g.'price'
)group_cols
: array of string(s) with columns to groupdf
by for quartile calculation purposes (e.g.['item_id']
)log_scale
: boolean specifying whether to use logarithmic scale for outlier removalk
: float specifying limit rangesQ1-k*IQR
andQ3+k*IQR
max_diffs
: list of tuples with two values, each tuple specifies total number of quotes and the maximal allowed ratio between max/min quotes (if violated, RFQ will be removed before the IQR outlier detection method)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ssmode-0.1.6.tar.gz
.
File metadata
- Download URL: ssmode-0.1.6.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9732a69efcd21812d99eff42c95f735204f1c830b017c2b1748623a9cd325ed5 |
|
MD5 | 21cc50c8d9ce57dca4c205522cfc43a3 |
|
BLAKE2b-256 | d14d63269fb73fa8823b1a33f65ccf9139d9adbed2151c48388fb0b1cf96b224 |
File details
Details for the file ssmode-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: ssmode-0.1.6-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31d74968f48848e091f861092a4d5fa86200da60018133051b9cb85cad31a157 |
|
MD5 | 2689d687c6f03441f8dce05387a572f6 |
|
BLAKE2b-256 | f1edcbe39b5b1ccf7d986a3f4013e9e706a38e7a767034ee848d7b3c0da77a0f |