diff --git a/daqviewer/tables.py b/daqviewer/tables.py index b1e7eda..701c2e6 100644 --- a/daqviewer/tables.py +++ b/daqviewer/tables.py @@ -7,11 +7,15 @@ import dash_html_components as html import pandas as pd import numpy as np +# __file__ = '.' csv_name = os.path.dirname(__file__) + '../statistics.csv' df = pd.read_csv(csv_name) +df_spec = df.copy() +df_spec.T + # Round floats -df.iloc[:, 1:] = np.round(df.iloc[:, 1:] * 100) / 100 +df = df.round(2) variables = { 'location': '', @@ -29,8 +33,8 @@ df = df[variables.keys()] # in this case the unique ID is just the country name, so we could have just # renamed 'country' to 'id' (but given it the display name 'country'), but # here it's duplicated just to show the more general pattern. -df['id'] = df.index -# df.set_index('id', inplace=True, drop=False) +df['id'] = df['location'] +df = df.set_index('id', drop=False) app = dash.Dash(__name__) @@ -48,7 +52,7 @@ app.layout = html.Div([ sort_mode='multi', row_selectable='multi', row_deletable=False, - selected_rows=list(df.index), + selected_rows=np.arange(df.shape[0]), style_as_list_view=True, ), html.Div(id='datatable-row-ids-container') @@ -125,4 +129,4 @@ def update_graphs(row_ids, selected_row_ids, active_cell): if __name__ == '__main__': - app.run_server(debug=True) + app.run_server(debug=False)