'Blocking a big number from appearing in PLOT Pandas

Here's my issue : i have a dataframe that reads from a csv like this

DAY;FILE_TYPE
20210101;csv
20210102;xml
20210102;xml
20210102;xml
20210103;doc

i want to plot the count of evry type of file except the 'doc' file ;here is my code that reads from the file calculates counts in a crosstab and creates the chart:

df=pd.read_csv(r"/applis/prisme/informatica/version/scripts/test2.csv",sep=';')
tab=pd.crosstab(df['DAY'],df['FILE_TYPE'])
tab=tab.drop(['doc'],errors='ignore',axis=1)
fig=plt.figure()
tab.plot(kind='bar',figsize=(16,15))
plt.yticks(np.arange(0, 2, 1))

and this is my chart i get

enter image description here

Now my issue is in the plot: supposingly that i sized the yticks at maximum '2' what i wanna do is when the bar exceed from that value , i want it to be blocked at that value and a label bar appears on it indicating it's real value like this.

enter image description here

PS: i'm using python 2.7 (bar_label doesn'work for me)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source