# -*- coding:utf-8 -*-
"""
作者:sunli
日期:2022年06月21日14:49
"""
# -*- coding:utf-8 -*-
import os
import numpy as np
import pandas as pd
path0 = r"D:\shujuji\SisFall_dataset"
path1 = r"D:\shujuji\SisFall_dataset" + '\\'
# 列出当前目录下所有的文件
files = os.listdir(path0)
print('files', files)
for filename in files:
path = path1 + filename
file = os.listdir(path)
for file_ in file:
portion = os.path.splitext(file_)
# 如果后缀是.csv
if portion[1] == ".csv":
filenamedir = path + '\\'+ file_
data = pd.read_csv(filenamedir, index_col=False, header=None)
data_size = len(data)
col_data = np.arange(0, data_size, 1)
extract_data = data.iloc[col_data, [0, 1, 2, 3, 4, 5]]
extract_data.columns = ["acc_x", "acc_y", "acc_z", "gyro_x", "gyro_y", "gyro_z"]
extract_data.to_csv(filenamedir, index=None)
版权声明:本文为weixin_51443598原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。