Python data visualization commonly used matplotlib library, matplotlib is the underlying library, today I learned pandas data visualization, compared to matplotlib library, much simpler.
%matplotlib inline import numpy as np import pandas as pd x1 = pd.Series(np.random.normal(size=10)) x1.plot()
We can also add grid parameters to add grids:
x1.plot(grid=True)
Take the short book data from the previous article as an example:
jianshu.groupby(jianshu.index)[['view']].sum().sort(['view'],ascending=False)[0:5].plot(kind='bar')
jianshu.groupby(jianshu.index)[['gain']].sum().sort(['gain'],ascending=False)[0:10].plot(kind='barh')
Pandas drawing is actually inherited from the matplotlib library, and the matplotlib library defaults to ASCII encoding, so the Chinese drawing will be garbled. We need to go to the matplotlibrc file in the matplotlib library to set it up.
Open the matplotlibrc file, uncomment the following line, and add SimHei after the colon in font.sans-serif, which is a Chinese font. Just restart python.
font.family: sans-serif font.sans-serif: SimHei axes.unicode_minus