我的数据集中有两列。我需要计算每列中每个值的重复次数并将它们绘制在一起。基本上,我的整个数据集分为两列。两个列都需要检查值的重复。最后,我想对关键与计数作图。
1st_Axle 2nd_Axle,
4510.0 2670.0,
3500.0 7070.0,
4570.0 2490.0,
4910.0 6490.0
4930.0 6470.0
4500.0 3810.0
3630.0 6940.0
4450.0 5310.0
5240.0 4820.0
5190.0 5670.0
4240.0 2470.0
4600.0 5460.0
4340.0 1950.0
3870.0 5340.0
4420.0 6430.0
5160.0 7010.0
for weight in Axle:
bucket = int(weight/1000)
if bucket not in table: table[bucket] = 1
else: table[bucket] += 1
plt.plot(sorted(table.keys()), [table[key] for key in sorted(table.keys())],marker='o', markerfacecolor='g')
plt.title('Class 9 GVW distribution')
plt.xlabel('GVW of Class 9 vehicle multiple of 1000 kg')
plt.ylabel('Count')```