v.0.12
On 2022.12.13
pip install --upgrade shimoku-api-pythonImprovements

data_ = [{ "color": "success", "variant": "contained", "description": "This indicator has a Link", "targetPath": "/indicators/indicator/1", "title": "Target Indicator", "align": "left", "value": "500€" }, { "color": "warning", "backgroundImage": "https://images.unsplash.com/photo-1535957998253-26ae1ef29506?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=736&q=80", "variant": "outlined", "description": "This has a background", "title": "Super cool indicator", "align": "left", "value": "Value" }, { "color": "error", "variant": "outlined", "description": "This hasn't got any icons", "title": "Error indicator", "align": "left", "value": "Value", }, { "color": "caution", "variant": "contained", "description": "Aligned to right and full of icons", "title": "Multiple cases", "align": "right", "value": "Value", } ] s.plt.indicator( data=data_, menu_path=menu_path, order=2, rows_size=2, cols_size=12, value='value', header='title', footer='description', align='align', color='color', variant='variant', target_path='targetPath', background_image='backgroundImage', )Segment, Price, Client category, Age, Geo, Acquisitive power, Family size, Policie tenure, Labour contract Hogar, 21, 5, 12, 17, 3, 14, 3, 6 Móvil, 23, 16, 16, 14, 4, 2, 19, 12 Dental, 26, 21, 14, 17, 1, 2, 6, 3 Viajes, 24, 22, 15, 17, 8, 5, 15, 4 Accidentes, 22, 12, 18, 17, 5, 6, 1, 5 Seguro de vida, 22, 21, 19, 12, 7, 3, 2, 9 Jurídico, 25, 21, 13, 12, 10, 6, 13, 6 Dental Plus, 24, 4, 17, 17, 7, 9, 2, 3 Jubilación, 20, 4, 19, 17, 2, 2, 10, 8 Salud, 27, 24, 17, 17, 12, 1, 4, 1data = pd.read_csv('file.csv') s.plt.stacked_barchart( data=data, menu_path=menu_path, x="Segment", x_axis_name='Distribution and weight of the Drivers', order=0, rows_size=3, cols_size=12, )
Default result data = pd.read_csv('file.csv') s.plt.stacked_barchart( data=data_, menu_path=menu_path, x="Segment", x_axis_name='Distribution and weight of the Drivers', order=0, rows_size=3, cols_size=12, show_values=['Price'], calculate_percentages=True, )
Result calculating percentages per category and showing only the first level of values. 'success', 'error', 'warning', 'success-light', 'error-light', 'warning-light', 'status-error's.plt.shimoku_gauge( value=-48, menu_path=menu_path, order=0, rows_size=1, cols_size=3, name="Shimoku", color=1) s.plt.shimoku_gauge( value=3.56, menu_path=menu_path, order=1, rows_size=1, cols_size=3, color="status-error") s.plt.shimoku_gauge( value=-90, menu_path=menu_path, order=2, rows_size=1, cols_size=3, name="gauges", color='#00F0FF')
Shimoku gauges menu_path: str = 'test/shimoku-gauges' df = pd.read_csv('file.csv') gauges_data = pd.DataFrame(columns=["name", "value", "color"]) df_transposed = df.transpose().reset_index().drop(0) value_columns = [col for col in df_transposed.columns if col != "index"] gauges_data["value"] = df_transposed[value_columns].apply(lambda row: sum(row), axis=1) gauges_data["name"] = df_transposed['index'] gauges_data["color"] = range(1, len(df_transposed) + 1) order = s.plt.shimoku_gauges_group( gauges_data=gauges_data, order=0, menu_path=menu_path, cols_size=12, rows_size=3, calculate_percentages=True, )
Shimoku gauges group with percentages calculated
Last updated
Was this helpful?