我有一个csv文件,看起来像这样
time,a1,a2,a3,a4,a5
0,0.0598729227761,0.0598729227761,0.0,-0.0598729227761
1,0.0598729227761,0.0598729227761,0.0,-0.0598729227761
2,0.0,-0.0598729227761,0.0,-0.0598729227761
3,0.0,-0.0598729227761,0.0,-0.0598729227761
4,0.0,-0.0598729227761,0.0,-0.0598729227761
5,0.0,-0.0598729227761,0.0,-0.0598729227761
6,0.0,-0.0598729227761,0.0,-0.0598729227761
7,0.0,-0.0598729227761,0.0,-0.0598729227761
8,0.0,-0.0598729227761,0.0,-0.0598729227761
9,0.0,-0.0598729227761,0.0,-0.0598729227761
10,0.0,-0.0598729227761,0.0,-0.0598729227761
11,0.0,-0.0598729227761,0.0,-0.0598729227761
12,0.0,0.179618768328,-0.0598729227761,-0.0598729227761
13,0.0,0.179618768328,-0.0598729227761,-0.0598729227761
14,0.0,0.179618768328,-0.0598729227761,-0.0598729227761
15,0.0,0.179618768328,-0.0598729227761,-0.0598729227761
16,0.0,0.179618768328,-0.0598729227761,-0.0598729227761
17,0.0,0.179618768328,-0.0598729227761,-0.0598729227761
18,0.0,0.179618768328,-0.0598729227761,-0.0598729227761
19,0.0,0.179618768328,-0.0598729227761,-0.0598729227761
20,0.0,0.179618768328,-0.0598729227761,-0.0598729227761
21,-0.119745845552,0.0,-0.0598729227761,-0.0598729227761
22,-0.119745845552,0.0,-0.0598729227761,-0.0598729227761
23,-0.119745845552,0.0,-0.0598729227761,-0.0598729227761
24,-0.119745845552,0.0,-0.0598729227761,-0.0598729227761
25,-0.119745845552,0.0,-0.0598729227761,-0.0598729227761
26,-0.119745845552,0.0,-0.0598729227761,-0.0598729227761
27,-0.119745845552,0.0,-0.0598729227761,-0.0598729227761
28,-0.119745845552,0.0,-0.0598729227761,-0.0598729227761
29,-0.119745845552,0.0,-0.0598729227761,-0.0598729227761
30,-0.119745845552,0.0598729227761,-0.0598729227761,-0.0598729227761
31,-0.119745845552,0.0598729227761,-0.0598729227761,-0.0598729227761
32,-0.119745845552,0.0598729227761,-0.0598729227761,-0.0598729227761
33,-0.119745845552,0.0598729227761,-0.0598729227761,-0.0598729227761
34,-0.119745845552,0.0598729227761,-0.0598729227761,-0.0598729227761
35,-0.119745845552,0.0598729227761,-0.0598729227761,-0.0598729227761
36,-0.119745845552,0.0598729227761,-0.0598729227761,-0.0598729227761
37,-0.119745845552,0.0598729227761,-0.0598729227761,-0.0598729227761
38,-0.119745845552,0.0598729227761,-0.0598729227761,-0.0598729227761
39,-0.119745845552,0.0598729227761,-0.0598729227761,-0.0598729227761
40,-0.0598729227761,0.0,0.0,-0.0598729227761
41,-0.0598729227761,0.0,0.0,-0.0598729227761
42,-0.0598729227761,0.0,0.0,-0.0598729227761
43,-0.0598729227761,0.0,0.0,-0.0598729227761
44,-0.0598729227761,0.0,0.0,-0.0598729227761
45,-0.0598729227761,0.0,0.0,-0.0598729227761
46,-0.0598729227761,0.0,0.0,-0.0598729227761
47,-0.0598729227761,0.0,0.0,-0.0598729227761
48,-0.0598729227761,0.0,0.0,-0.0598729227761
49,-0.0598729227761,0.0,0.0,-0.0598729227761
50,-0.0598729227761,0.0,0.0,-0.0598729227761
51,-0.0598729227761,0.0,0.0,-0.0598729227761
52,-0.0598729227761,0.0,0.0,-0.0598729227761
53,-0.0598729227761,0.0,0.0,-0.0598729227761
54,-0.0598729227761,0.0,0.0,-0.0598729227761
55,-0.0598729227761,0.0,0.0,-0.0598729227761
56,-0.0598729227761,0.0,0.0,-0.0598729227761
57,-0.0598729227761,0.0,0.0,-0.0598729227761
58,-0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
59,-0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
60,-0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
61,-0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
62,-0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
63,-0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
64,-0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
65,-0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
66,-0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
67,-0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
68,0.0,-0.0598729227761,0.0,-0.0598729227761
69,0.0,-0.0598729227761,0.0,-0.0598729227761
70,0.0,-0.0598729227761,0.0,-0.0598729227761
71,0.0,-0.0598729227761,0.0,-0.0598729227761
72,0.0,-0.0598729227761,0.0,-0.0598729227761
73,0.0,-0.0598729227761,0.0,-0.0598729227761
74,0.0,-0.0598729227761,0.0,-0.0598729227761
75,0.0,-0.0598729227761,0.0,-0.0598729227761
76,0.0,-0.0598729227761,0.0,-0.0598729227761
77,0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
78,0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
79,0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
80,0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
81,0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
82,0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
83,0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
84,0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
85,0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
86,0.0598729227761,0.0,-0.0598729227761,-0.0598729227761
87,-0.0598729227761,0.0598729227761,0.0,-0.0598729227761
88,-0.0598729227761,0.0598729227761,0.0,-0.0598729227761
89,-0.0598729227761,0.0598729227761,0.0,-0.0598729227761
90,-0.0598729227761,0.0598729227761,0.0,-0.0598729227761
91,-0.0598729227761,0.0598729227761,0.0,-0.0598729227761
92,-0.0598729227761,0.0598729227761,0.0,-0.0598729227761
93,-0.0598729227761,0.0598729227761,0.0,-0.0598729227761
94,-0.0598729227761,0.0598729227761,0.0,-0.0598729227761
95,-0.0598729227761,0.0598729227761,0.0,-0.0598729227761
96,0.0598729227761,-0.0598729227761,0.0598729227762,-0.0598729227761
97,0.0598729227761,-0.0598729227761,0.0598729227762,-0.0598729227761
98,0.0598729227761,-0.0598729227761,0.0598729227762,-0.0598729227761
99,0.0598729227761,-0.0598729227761,0.0598729227762,-0.0598729227761
100,0.0598729227761,-0.0598729227761,0.0598729227762,-0.0598729227761
101,0.0598729227761,-0.0598729227761,0.0598729227762,-0.0598729227761
102,0.0598729227761,-0.0598729227761,0.0598729227762,-0.0598729227761
103,0.0598729227761,-0.0598729227761,0.0598729227762,-0.0598729227761
104,0.0598729227761,-0.0598729227761,0.0598729227762,-0.0598729227761
使用
读取数据acc = mlab.csv2rec('filename.csv')
并且像这样绘制
plt.plot((acc.time)/100.00,acc.a1,label='A1')
我希望只采用唯一值,然后绘制它。是否可以仅在与当前行不同的情况下导入行。然后使用数据绘制。
答案 0 :(得分:0)
有python set
类型,你只能拥有每个值的一个副本;如果您不关心行号,只需将其从行中删除,然后将行提供给集合。
如果需要行号,可以使用不同的路径:从行中的值生成元组,并使用行号作为值,将该元组用作字典中的键。