d={}

with open("elect.txt", "r") as f:
for x in f:
x = x.strip()
if x!="木村" and x!="くれぱす":
x="無効票"
try:
d[x]+=1
except:
d[x]=1

x = d.keys()
y = d.values()

import matplotlib.pyplot as plt

%matplotlib inline
plt.bar(x,y)
plt.show() # 可視化