enter image description hereIm plotting Pie with values shown as % but values appear without "%" sign, I,m trying to add it("%") as string but says format is incomplete, when i remove it, it prints values without sign
I m using:
df['Sold Contract'].value_counts().plot(kind='pie', figsize=(5,5), legend= True, autopct ="%.1f")
And trying to USE :
df['Sold Contract'].value_counts().plot(kind='pie', figsize=(5,5), legend= True, autopct ="%.1f%")
or
autopct ="{%.1f}%"
or
autopct ="(%.1f) %"
or
autopct =("%.1f %")
Expecting to see % sign next to values on the PIE
CodePudding user response:
Actually, that is a very good question. The main reason is that normally when you want to use a special character inside a string as a character(", ', ) you use the backslash(/) before that character(", ', \). In the case of the % sign, you use two signs(so %%) inside your string to print one percent sign So: print("This is a percent sign: %%") -> This is a percent sign: % I hope that helps!