Not plotting 'zero' in matplotlib or change zero to None [Python]
问题 I have the code below and I would like to convert all zero's in the data to None 's (as I do not want to plot the data here in matplotlib). However, the code is notworking and 0. is still being printed sd_rel_track_sum=np.sum(sd_rel_track, axis=1) for i in sd_rel_track_sum: print i if i==0: i=None return sd_rel_track_sum Can anyone think of a solution to this. Or just an answer for how I can transfer all 0 to None . Or just not plot the zero values in Matplotlib. 回答1: values = [3, 5, 0, 3, 5,