Spaces:
Sleeping
Sleeping
Liu Yiwen
commited on
Commit
·
beccaa7
1
Parent(s):
c6efefe
修复了小数位保留的bug
Browse files- __pycache__/utils.cpython-311.pyc +0 -0
- app.py +2 -1
- utils.py +5 -4
__pycache__/utils.cpython-311.pyc
CHANGED
Binary files a/__pycache__/utils.cpython-311.pyc and b/__pycache__/utils.cpython-311.pyc differ
|
|
app.py
CHANGED
@@ -206,7 +206,8 @@ def get_page(dataset: str, config: str, split: str, page: str) -> Tuple[str, int
|
|
206 |
# Gradio app
|
207 |
#####################################################
|
208 |
|
209 |
-
|
|
|
210 |
with gr.Blocks() as demo:
|
211 |
# 初始化组件
|
212 |
gr.Markdown("A tool for interactive observation of lotsa dataset, extended from lhoestq/datasets-explorer")
|
|
|
206 |
# Gradio app
|
207 |
#####################################################
|
208 |
|
209 |
+
# 存取状态
|
210 |
+
# 保留小数位
|
211 |
with gr.Blocks() as demo:
|
212 |
# 初始化组件
|
213 |
gr.Markdown("A tool for interactive observation of lotsa dataset, extended from lhoestq/datasets-explorer")
|
utils.py
CHANGED
@@ -91,10 +91,10 @@ def create_statistic(dfs: list[pd.DataFrame], ids: list[str]):
|
|
91 |
for df, id in zip(dfs, ids):
|
92 |
df_values = df.iloc[:, 1:]
|
93 |
# 计算统计值
|
94 |
-
mean_values = df_values.mean()
|
95 |
-
std_values = df_values.std()
|
96 |
-
max_values = df_values.max()
|
97 |
-
min_values = df_values.min()
|
98 |
|
99 |
# 将这些统计信息合并成一个新的DataFrame
|
100 |
stats_df = pd.DataFrame({
|
@@ -108,6 +108,7 @@ def create_statistic(dfs: list[pd.DataFrame], ids: list[str]):
|
|
108 |
|
109 |
# 合并所有统计信息DataFrame
|
110 |
combined_stats_df = pd.concat(stats_list, ignore_index=True)
|
|
|
111 |
return combined_stats_df
|
112 |
|
113 |
def clean_up_df(df: pd.DataFrame, rows_to_include: list[int]) -> pd.DataFrame:
|
|
|
91 |
for df, id in zip(dfs, ids):
|
92 |
df_values = df.iloc[:, 1:]
|
93 |
# 计算统计值
|
94 |
+
mean_values = df_values.mean()
|
95 |
+
std_values = df_values.std()
|
96 |
+
max_values = df_values.max()
|
97 |
+
min_values = df_values.min()
|
98 |
|
99 |
# 将这些统计信息合并成一个新的DataFrame
|
100 |
stats_df = pd.DataFrame({
|
|
|
108 |
|
109 |
# 合并所有统计信息DataFrame
|
110 |
combined_stats_df = pd.concat(stats_list, ignore_index=True)
|
111 |
+
combined_stats_df = combined_stats_df.applymap(lambda x: round(x, 2) if isinstance(x, (int, float)) else x)
|
112 |
return combined_stats_df
|
113 |
|
114 |
def clean_up_df(df: pd.DataFrame, rows_to_include: list[int]) -> pd.DataFrame:
|