-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhenkan_csv.py
49 lines (45 loc) · 1.96 KB
/
henkan_csv.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import numpy as np
import matplotlib.pyplot as plt
import csv
'''
data_set_x = np.loadtxt(
fname='/Users/nemomac2/Desktop/data310/raw/data_out310.csv', #読み込むファイルのパスと名前
dtype='float', #floatで読み込む
delimiter=',', #csvなのでカンマで区切る
)
data_set_y = np.loadtxt(
fname='/Users/nemomac2/Desktop/data310/raw/data_test_out310.csv', #読み込むファイルのパスと名前
dtype='float', #floatで読み込む
delimiter=',', #csvなのでカンマで区切る
)
for i in range(len(data_set_x)):
print('data{}'.format(i))
for j in range(len(data_set_x[0])):
print('data{}, {}'.format(i, j))
with open('/Users/nemomac2/Desktop/data310/trans_data_out.csv', 'a') as f :
writer = csv.writer(f)
writer.writerow([data_set_x[i][j]])
with open('/Users/nemomac2/Desktop/data310/trans_data_test_out.csv', 'a') as fc :
writer = csv.writer(fc)
writer.writerow([data_set_y[i][j]])
'''
data_set_x = np.loadtxt(
fname='/Users/nemomac2/Desktop/data310/raw/smoothing_out310.csv', #読み込むファイルのパスと名前
dtype='float', #floatで読み込む
delimiter=',', #csvなのでカンマで区切る
)
data_set_y = np.loadtxt(
fname='/Users/nemomac2/Desktop/data310/raw/smoothing_test_out310.csv', #読み込むファイルのパスと名前
dtype='float', #floatで読み込む
delimiter=',', #csvなのでカンマで区切る
)
for i in range(len(data_set_x)):
print('data{}'.format(i))
for j in range(len(data_set_x[0])):
print('data{}, {}'.format(i, j))
with open('/Users/nemomac2/Desktop/data310/trans_smoothing_data_out.csv', 'a') as f :
writer = csv.writer(f)
writer.writerow([data_set_x[i][j]])
with open('/Users/nemomac2/Desktop/data310/trans_data_smoothing_test_out.csv', 'a') as fc :
writer = csv.writer(fc)
writer.writerow([data_set_y[i][j]])