Skip to content

HTML styling set_precision should take subset #11656

Closed
@mattilyra

Description

@mattilyra

There's a problem in the way .set_precision currently works as it is being applied to all table cells indiscriminately. For instance a dataframe with means and standard errors cross validated across some parameter values the set_precision will easily hide a lot of detail in the results.

screen shot 2015-11-20 at 12 03 14

The second parameter (2nd index) is not all zeros, they're just values in the range [1e-4, 1e-3]. Also while for the mean columns a precision of 2 is fine, for the standard error 4 might be more appropriate. So having a subset= keyword argument also for .set_precision would be great.

screen shot 2015-11-20 at 12 02 56


code for making the df

import itertools
import pandas as pd
import numpy as np

jobs = itertools.product(['a', 'b', 'c', 'd'], np.arange(1e-4, 1e-3, .0003), range(10))
rows = []
for v, v2, itr in jobs:
    rows.append({'param_1': v, 'param_2': v2, 'iter': itr,
                 'score_1': np.random.randint(0, 100, size=(1,))[0],
                 'score_2': np.random.rand(1, )[0]})
df_multi = pd.DataFrame(rows)
agg = df_multi.groupby(by=['param_1', 'param_2'])[['score_1', 'score_2']].agg(['mean', 'sem'])

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIO HTMLread_html, to_html, Styler.apply, Styler.applymap

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions