Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,12 +5,7 @@ import warnings
|
|
5 |
|
6 |
warnings.filterwarnings(action='ignore', category=UserWarning)
|
7 |
|
8 |
-
#
|
9 |
-
from matplotlib import font_manager
|
10 |
-
|
11 |
-
for font in font_manager.fontManager.ttflist:
|
12 |
-
# 查看字体名以及对应的字体文件名
|
13 |
-
print(font.name, '-', font.fname)
|
14 |
plt.rcParams['axes.unicode_minus'] = False # 设置正常显示字符
|
15 |
|
16 |
def process_file(file):
|
@@ -50,7 +45,8 @@ def generate_output(file, column1, column2, choice, bins):
|
|
50 |
# 自动判断column1的数据类型
|
51 |
if choice == "是":
|
52 |
# 如果是连续值,则进行分组
|
53 |
-
data_x = pd.qcut(data_x, q=bins, duplicates='drop')
|
|
|
54 |
else:
|
55 |
# 如果是离散值,则直接使用
|
56 |
pass
|
|
|
5 |
|
6 |
warnings.filterwarnings(action='ignore', category=UserWarning)
|
7 |
|
8 |
+
plt.rcParams['font.sans-serif'] = ['DejaVu Sans'] # 选择合适的中文字体
|
|
|
|
|
|
|
|
|
|
|
9 |
plt.rcParams['axes.unicode_minus'] = False # 设置正常显示字符
|
10 |
|
11 |
def process_file(file):
|
|
|
45 |
# 自动判断column1的数据类型
|
46 |
if choice == "是":
|
47 |
# 如果是连续值,则进行分组
|
48 |
+
data_x = pd.qcut(data_x, q=bins, duplicates='drop')
|
49 |
+
data_x = data_x.apply(lambda x: f'{x.left:.2f} - {x.right:.2f}')
|
50 |
else:
|
51 |
# 如果是离散值,则直接使用
|
52 |
pass
|