You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.0 KiB
36 lines
1.0 KiB
# -*- coding: utf-8 -*- |
|
""" |
|
Spyder Editor |
|
|
|
This is a temporary script file. |
|
""" |
|
|
|
import os |
|
import pandas as pd |
|
|
|
WeekPath = 'D:\AcA Mike Dijkhof\cwa files\Pt203_csv' # path to directory with .csv file of entire week |
|
ScriptPath = 'D:\AcA Mike Dijkhof\Scripts' # path to directory of formules.py |
|
|
|
os.chdir(ScriptPath) |
|
|
|
import formules |
|
|
|
os.chdir(WeekPath) |
|
|
|
#%% |
|
|
|
for subdir, dirs, files in os.walk(WeekPath): |
|
print(subdir) |
|
os.chdir(subdir) |
|
for i in files: |
|
print(i) |
|
if i.startswith('._'): #skip ._ files that may be present in the folder |
|
continue |
|
|
|
df = pd.read_csv(i, header=0, names=['Datetime', 'Acc X','Acc Y', 'Acc Z'], dtype={"Datetime": str, "Acc X": 'float32', "Acc Y": 'float32', "Acc Z": 'float32'}, infer_datetime_format=True) |
|
df['Datetime'] = pd.to_datetime(df['Datetime']) |
|
df['Date'] = [d.date() for d in df['Datetime']] |
|
df = df.reindex(columns=['Datetime','Date','Time','Acc X','Acc Y', 'Acc Z']) |
|
|
|
formules.CreateDays(df, i, subdir) |
|
os.chdir(subdir) |