-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpichart python
More file actions
42 lines (40 loc) · 1.52 KB
/
pichart python
File metadata and controls
42 lines (40 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import colorama
from colorama import Back, Fore, Style
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
colorama.init()
print(Fore.GREEN + "*****************************************")
print(Fore.RED + " Real Time Revenue and Expenditure ")
print(Fore.RED + "with financial analysis using infographic ")
print(Fore.RED + " -project by ")
print(Fore.RED + " vigneshwaran ")
print(Fore.GREEN + "*****************************************")
input()
data = pd.read_csv(r"C:\Users\richie\Downloads\India_budget_2021.csv")
data.head()
print(data)
lst = []
# number of elements as input
n = int(input("Enter number of budgets to be partitioned : "))
print("select the department number one by one:")
# iterating till the range
for i in range(0, n):
ele = int(input())
lst.append(ele) # adding the element
print(lst)
val =lst
data = data.iloc[val,:]
row = {'Department /Ministry': 'OTHERS', 'Fund allotted(in ₹crores)': 592971.0800000001}
data = data.append(row, ignore_index = True)
data.plot.bar(x='Department /Ministry', y='Fund allotted(in ₹crores)')
df = data["Fund allotted(in ₹crores)"]
labels = data["Department /Ministry"]
plt.figure(figsize=(7,7))
plt.pie(df, labels=labels, autopct='%1.1f%%', startangle=90, pctdistance=0.85, shadow =True)
central_circle = plt.Circle((0, 0), 0.5, color='white')
fig = plt.gcf()
fig.gca().add_artist(central_circle)
plt.rc('font', size=12)
plt.title("Distribution of The Budget", fontsize=20)
plt.show()