Like if i have a data frame with four columns and i want to plot any two columns of it just to visualize my data. And we can find the value of all the parameters by using this
pd.describe()
count 332.000000
mean 5645.999337
std 391.081389
min 4952.290000
25% 5294.402500
50% 5647.905000
75% 6028.805000
max 6290.980000
Now, how can we put the information that we get with this function ('pandas.describe') into the plot in just one go. Instead of using the usual 'label' function from matplotlib. 
Matplotlib has the option ax.text. So you need to convert this info into text. Here comes an example:
import pandas as pd
df=pd.DataFrame({'A':[1,2,3]})
desc=df.describe()
Describe is also a DataFrame, you can turn every column into a string list:
data1=[i for i in desc.index]
data2=[str(i) for i in desc.A]
Now you can join both with a colon in between:
text= ('\n'.join([ a +':'+ b for a,b in zip(data1,data2)]))
Then in your graph, you can input:
ax.text(pos1, pos2, text , fontsize=15)
Where pos1 and pos2are numbers for the position of your text.
Does that help?
Tell me!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With