我在Python中具有以下数组:
numbers=[75, 100, 680, 123, 4, 4, 8, 15]
这些数字对应于与特定聚类关联的点数。
因此,在绘制聚类点时,我希望有一个图例,该图例提供以下信息:
"Cluster 1 has 75 points"
"Cluster 2 has 100 points"
以此类推。
我很难对循环进行编码,因此我们将不胜感激。
答案 0 :(得分:1)
提供更多信息后,我认为您需要这样做:
path = r'...'
all_files = glob.glob(path + '/*.csv')
df_from_each_file = [pd.read_csv(f, error_bad_lines=False) for f in all_files]
concatenated_df = pd.concat(df_from_each_file, ignore_index=True)
编辑1:如何使用for循环创建图例。
a a.1 a.2 command description
0 NaN NaN NaN aaa ikegroup WORD Name of the IKE group
1 NaN NaN NaN aaa ikegroup <cr> NaN
2 NaN NaN NaN aaa locald trace Show trace data for the locald component(cisco...
3 NaN NaN NaN aaa login trace Show trace data for login sub system
4 NaN NaN NaN aaa password-policy statistics Show statistics related to password policy