Each country has a financial budget that describes the government’s spending capacity in different sectors of the economy. In this article, I will walk you through the task of financial budget analysis with Python.
What is a Financial Budget?
There are so many Data Analysts today that come from a non-coding background. If you are from a commerce background then you may know what is a financial budget. In short, it is a detailed report on the income and expenditure of the government for a financial year.
You may get the task of analyzing a country’s financial budget every year if you are working as a data analyst in the media and communications field, as the media have to explain the government’s priorities for the complete financial year. In the section below, I will take you through a tutorial on how to perform the task of Financial Budget analysis with Python.
Financial Budget Analysis with Python
I hope you now have understood what is a financial budget and when you may need to analyze it as a data analyst. Let’s see how we can perform the task of financial budget analysis with Python. I will start this task by importing the necessary Python libraries and a dataset that contains data about the financial budget of India for the year 2021:
Department /Ministry Fund allotted(in ₹crores) 0 MINISTRY OF AGRICULTURE 131531.19 1 DEPARTMENT OF ATOMIC ENERGY 18264.89 2 MINISTRY OF AYURVEDA, YOGA 2970.30 3 MINISTRY OF CHEMICALS AND FERTILISER 80714.94 4 MINISTRY OF CIVIL AVIATION 3224.67
Let’s have a look at all the departments that are covered in this budget:
Department /Ministry Fund allotted(in ₹crores) 0 MINISTRY OF AGRICULTURE 131531.19 1 DEPARTMENT OF ATOMIC ENERGY 18264.89 2 MINISTRY OF AYURVEDA, YOGA 2970.30 3 MINISTRY OF CHEMICALS AND FERTILISER 80714.94 4 MINISTRY OF CIVIL AVIATION 3224.67 5 MINISTRY OF COAL 534.88 6 MINISTRY OF COMMERCE AND INDUSTRY 12768.25 7 MINISTRY OF COMMUNICATION 75265.22 8 MINISTRY OF CONSUMER AFFAIRS 256948.40 9 MINISTRY OF CORPORATE AFFAIRS 712.13 10 MINISTRY OF CULTURE 2687.99 11 MINISTRY OF DEFENCE 478195.62 12 MINISTRY OF DEVELOPMENT OF NORTH EASTERN REGION 2658.00 13 MINISTRY OF EARTH SCIENCES 1897.13 14 MINISTRY OF EDUCATION 93224.31 15 MINISTRY OF ELECTRONICS AND INFORMATION TECHNO... 9720.66 16 MINISTRY OF ENVIRONMENT, FOREST 2869.93 17 MINISTRY OF EXTERNAL AFFAIRS 18154.73 18 MINISTRY OF FINANCE 1386273.30 19 MINISTRY OF FISHERIES, ANIMAL HUSBANDRY 4322.82 20 MINISTRY OF FOOD PROCESSING INDUSTRIES 1308.66 21 MINISTRY OF HEALTH AND FAMILY WELFARE 73931.77 22 MINISTRY OF HEAVY INDUSTRIES 1017.08 23 MINISTRY OF HOME AFFAIRS 166546.94 24 MINISTRY OF HOUSING AND URBAN AFFAIRS 54581.00 25 MINISTRY OF INFORMATION AND BROADCASTING 4071.23 26 MINISTRY OF JAL SHAKTI 69053.02 27 MINISTRY OF LABOUR AND EMPLOYMENT 13306.50 28 MINISTRY OF LAW AND JUSTICE 3229.94 29 MINISTRY OF MICRO, SMALL AND MEDIUM ENTERPRISES 15699.65 30 MINISTRY OF MINES 1466.82 31 MINISTRY OF MINORITY AFFAIR 4810.77 32 MINISTRY OF NEW AND RENEWABLE ENERGY 5753.00 33 MINISTRY OF PANCHAYATI RAJ 913.43 34 MINISTRY OF PARLIAMENTARY AFFAIRS 65.07 35 MINISTRY OF PERSONNEL, PUBLIC GRIEVANCES 2097.24 36 MINISTRY OF PETROLEUM AND NATURAL GAS 15943.78 37 MINISTRY OF PLANNING 1062.77 38 MINISTRY OF PORTS, SHIPPING 1702.35 39 MINISTRY OF POWER 15322.00 40 THE PRESIDENT, PARLIAMENT, UNION PUBLIC SERVIC... 1687.57 41 MINISTRY OF RAILWAYS 110054.64 42 MINISTRY OF ROAD TRANSPORT AND HIGHWAY 118101.00 43 MINISTRY OF RURAL DEVELOPMENT 133689.50 44 MINISTRY OF SCIENCE AND TECHNOLOGY 14794.03 45 MINISTRY OF SKILL DEVELOPMENT 2785.23 46 MINISTRY OF SOCIAL JUSTICE AND EMPOWERMENT 11689.39 47 DEPARMENT OF SPACE 13949.09 48 MINISTRY OF STATISTICS 1409.13 49 MINISTRY OF STEEL 39.25 50 MINISTRY OF TEXTILES 3631.64 51 MINISTRY OF TOURISM 2026.77 52 MINISTRY OF TRIBAL AFFAIRS 7524.87 53 MINISTRY OF WOMEN AND CHILD DEVELOPMENT 24435.00 54 MINISTRY OF YOUTH AFFAIRS AND SPORTS 2596.14 55 NaN NaN 56 GRAND TOTAL 3483235.63
I can see a NaN value in this dataset, let’s remove the NaN values and continue with the task of financial budget analysis with Python:
I can see that not all the departments that are covered in this dataset are the main departments, as some departments can be covered in the others category. So let’s prepare the data by only selecting the main departments and putting all the other departments in the other category:
Department /Ministry Fund allotted(in ₹crores) 0 MINISTRY OF AGRICULTURE 131531.19 1 MINISTRY OF CONSUMER AFFAIRS 256948.40 2 MINISTRY OF DEFENCE 478195.62 3 MINISTRY OF EDUCATION 93224.31 4 MINISTRY OF FINANCE 1386273.30 5 MINISTRY OF HOME AFFAIRS 166546.94 6 MINISTRY OF RAILWAYS 110054.64 7 MINISTRY OF ROAD TRANSPORT AND HIGHWAY 118101.00 8 MINISTRY OF RURAL DEVELOPMENT 133689.50 9 OTHERS 592971.08
Now let’s plot this data to have a look at the priorities of the government for the financial year:
data.plot.bar(x='Department /Ministry', y='Fund allotted(in ₹crores)')
We can see that the finance department is getting the most of the share from the total budget of the government. Now let’s plot this data into a donut plot to have a clear view of the distribution of funds among all the departments:
We can see that the finance department is getting 40% of the funds. So this is how we can analyze a dataset that contains data about the revenue and expenditure of the government for a financial year. I hope you liked this article on Financial Budget analysis with Python. Feel free to ask your valuable questions in the comments section below.
this is so amazing, thank you really for this
Thanks🤝 keep visiting 😀