# -*- coding:utf-8 -*-
"""
作者:sunli
日期:2022年03月30日14:43
"""
import csv
import os
import matplotlib.pyplot as plt
dir_path = 'D:/Dt/MobiAct_Dataset_v2.0/Data/train'
Label_count = {'0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0,
'12': 0} # 字典
for i in os.listdir(dir_path):
if os.path.isfile(dir_path + "/" + i):
with open(dir_path + "/" + i) as file:
datas = csv.reader(file)
next(datas)
for data in datas:
Label_count[data[6]] = Label_count[data[6]] + 1
c = sorted(Label_count.items())#
print(c)
Label_count["Falling"] = Label_count.pop("0")
Label_count["Standing"] = Label_count.pop("1")
Label_count["W
python统计行数
最新推荐文章于 2024-07-20 17:12:48 发布