ReadMulCsvToOneDataFrame

读取一个csv文件的数据,放在列表里面。
并把这个列表的数据放到一个DataFrame里,这是一个多列的矩阵。可以参考

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#creating and plotting the data

#creating some data - we will create a sinus and a sinus * sinus function
shift = 7
trainLength = 800
totalLength = 1200

data = np.empty((1,totalLength,2)) #0 to 1199

#x for the first sinus
base1 = np.array(range(totalLength))*(30*math.pi/totalLength) #30*pi means 15 complete oscilations
#the first sinus
data[0,:,0] = np.sin(base1)

#x for the second sinus - this reflects in a sinus with a different frequency
base2 = 0.8*base1


#the first * the second sinus
data[0,:,1] = (np.sin(base1)+np.sin(base2))/2

print('data: ', data.shape)

这样做的目的可以把原始的csv数据,放到一个csv里面,这样方便观察数据。

其实手动放置现有的数据是很方便的,可以不用浪费时间研究这个函数。。。

“TypeError: unhashable type: ‘numpy.ndarray’”

再利用for循环读取一个文件夹里的csv的时候,报的错误。

原因:csv文件名有中文。。。。。。
注:报的错误真的好坑啊。。。