How to use Python to draw the changing History of Local Fiscal Revenue in the past 20 years
This article is about how to use Python to draw the history of local fiscal revenue changes in the past 20 years. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article. Without saying much, let's take a look.
Bar_char_race_cn library solution
The problem that the bar_chart_race library does not support Chinese
Install pip install bar_char_race_cn
Note:
Ffmpeg should be installed in advance before use.
Use
Prepare test data
Import pandas as pd
Df = pd.read_csv ('data/ Revenue .csv')
Def year2timestamp (year):
# convert to date format of comparable size
Return pd.Timestamp (str (year))
Df ['year'] = df [' year'] .apply (year2timestamp)
Df.set_index ('year', inplace=True)
Df.sort_index (inplace=True) # sort dates from smallest to largest
Visual code
Import bar_chart_race_cn as bcr
Bcr.bar_chart_race (df=df
Filename=' provincial financial revenue in the past 20 years. MP4'
Title=' provincial revenue in the past 20 years (unit: 100 million yuan)'
)
Effect.
A small case study of previous articles: Pandas's apply method
Quick introduction to Python Grammar Python Web crawlers and text data Analysis after reading this article you will understand what is the application of text analysis in the field of economics and management: the application of text analysis in marketing research look at the partisan tendencies of journalists' manuscripts from their Twitter concerns?
Pandas time series data operation 70g regular expression shreport library for text data cleaning of listed companies: batch download methods and techniques for improving the performance of Numpy and Pandas of listed companies on the Shanghai Stock Exchange ~ pandas can seamlessly connect BokehYelpDaset: hotel management data set 10g half an hour to learn Markdown markup syntax
The above is how to use Python to draw the history of local fiscal revenue changes in the past 20 years. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.