-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_data.py
More file actions
executable file
·31 lines (22 loc) · 875 Bytes
/
update_data.py
File metadata and controls
executable file
·31 lines (22 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
import argparse
import shutil
import pandas as pd
import sensorutils
def process(filename):
backup = filename + '.BAK'
print(f'backing up {filename} -> {backup}')
shutil.copy(filename, backup)
dataframe = pd.read_csv(filename, index_col=False, names=sensorutils.COLUMNS)
print(f'data: {dataframe.shape}')
dataframe['resistance'] = round(dataframe['resistance'] / 1000)
print(f'writing {filename}')
dataframe.to_csv(filename, index=False, header=False)
return
parser = argparse.ArgumentParser(description="Convert data files from Ω to kΩ",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('files', metavar='FILE(S)', nargs='*',
help='files')
options = parser.parse_args()
for data_file in options.files:
process(data_file)