def read_folder(stats_folder, metrics=None):
"""
Reads all segment statistics files from the given folder and returns the statistics as a single DataFrame.
:param stats_folder: The folder to reat statistics files from.
:param metrics: A subset of the metrics to load.
:return: A DataFrame with all the statistics available in stats_folder.
"""
if metrics is None:
metrics = ['absolute mean', 'absolute median', 'kurtosis', 'skew', 'std']
glob_pattern = os.path.join(stats_folder, '*segments_statistics.csv')
files = glob.glob(glob_pattern)
if files:
stats = pd.concat([read_stats(stat_file, metrics) for stat_file in files])
return stats
else:
raise IOError("No segment statistics file in folder {}".format(stats_folder))
basic_segment_statistics.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录