-
Notifications
You must be signed in to change notification settings - Fork 0
/
rishabh.py
276 lines (238 loc) · 8.93 KB
/
rishabh.py
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
import pandas as pd
import numpy as np
import time
import matplotlib.pyplot as plt
df =pd.DataFrame()
csv_file = ("project.csv")
def introduction():
msg='''*********************************************************************************************************\n
WELCOME TO ANALYSIS SYSTEM OF CLASS 12\n
****************************************************************************************************************'''
for x in msg:
print(x,end ='')
time.sleep(0.005)
wait = input('Press any key to continue.....')
def made_by():
msg='''
Project By: Sambhav Jain
Class:12 Science
School:Rishabh Public School
'''
for x in msg:
print(x, end='')
time.sleep(0.002)
wait = input('Press any key to continue.....')
def read_csv_file():
df =pd.read_csv(csv_file)
print(df)
# name of function : clear
# purpose : clear output screen
def clear():
for x in range(65):
print()
def data_analysis_menu():
df = pd.read_csv(csv_file)
while True:
clear()
print('\n\nData Analysis MENU ')
print('_'*100)
print('1. Show Whole DataFrame\n')
print('2. Show Top Rows\n')
print('3. Show Specific Column\n')
print('4. Add a New Record\n')
print('5. Add a New Column\n')
print('6. Delete a Column\n')
print('7. Delete a Record\n')
print('8. EXIT')
ch = int(input('Enter your choice:'))
if ch == 1:
print(df)
wait = input()
if ch == 2:
n = int(input('Enter Total rows you want to show :'))
print(df.head(n))
wait = input()
if ch == 3:
print(df.columns)
col_name = input('Enter Column Name that You want to print : ')
print(df[col_name])
wait = input()
if ch==4:
a = int(input('Enter Sr. No.:'))
b = int(input('Enter Date:'))
c = int(input(' Enter Rate:'))
d = int(input('Enter Barcode:'))
e = input('Enter Name of the Customer:')
f = int(input('Enter APP ID:'))
g = input('Enter STATUS:')
h = input('Enter CONDITION:')
i = input('Enter Vehicle name:')
j = int(input('Enter Loan Amount:'))
k = int(input('Enter Tenure:'))
l = input('Enter Dealer Name:')
m = input('Enter EX NAME:')
data={'Sr. No.':a,'Date':b,'Rate':c,'Barcode':d,'Name of the Customer':e,'APP ID':f,
'STATUS':g,'CONDITION':h,'Vehicle name':i,'Loan Amount':j,'Tenure':k,
'Dealer Name':l,'EX NAME:':m}
df = df.append(data,ignore_index=True)
print(df)
wait=input()
if ch==5:
col_name = input('Enter new column name :')
col_value = int(input('Enter default value of column :'))
df[col_name]=col_value
print(df)
print('\n\n\n Press any key to continue....')
wait=input()
if ch==6:
col_name =input('Enter column Name to delete :')
del df[col_name]
print(df)
print('\n\n\n Press any key to continue....')
wait=input()
if ch==7:
index_no =int(input('Enter the Index Number that You want to delete :'))
df = df.drop(df.index[index_no])
print(df)
print('\n\n\n Press any key to continue....')
wait = input()
if ch == 8:
break
# name of function : graph
# purpose : To generate a Graph menu
def graph():
df = pd.read_csv(csv_file)
while True:
clear()
print('\nData Visualisation ')
print('_'*100)
print('1. line graph acc to Loan Amount')
print('2. line graph acc to Rate ')
print('3. deptwise highest tenure')
print('4. bar graph acc to highest loan amount')
print('5. deptwise Tenure')
print('6. exit')
ch = int(input('Enter your choice:' ))
if ch==1:
g = df.groupby('SR.NO')
x = df['SR.NO'].unique()
y = g['Loan Amount'].sum()
plt.xticks(rotation='vertical')
plt.xlabel('SR.NO')
plt.ylabel('Loan Amount')
plt.title('line graph acc to loan amount')
plt.grid(True)
plt.plot(x, y)
plt.show()
if ch==2:
g = df.groupby('SR.NO')
x = df['SR.NO'].unique()
y = g['RATE'].sum()
plt.xticks(rotation=30)
plt.xlabel('SR.NO')
plt.ylabel('RATE')
plt.title('line graph acc to RATE')
plt.plot(x, y)
plt.grid(True)
plt.show()
wait = input()
if ch==3:
g = df.groupby("SR.NO")
x = df['SR.NO'].unique()
y = g['Tenure'].sum()
plt.xlabel('SR.NO')
plt.ylabel('HIGHEST TENURE')
plt.xticks(rotation=30)
plt.title('DEPTWISE HIGHEST Tenure')
plt.bar(x,y)
plt.grid(True)
plt.show()
if ch==4:
g = df.groupby("Name of the Customer")
x = df['Name of the Customer'].unique()
y = g['Loan Amount'].sum()
plt.bar(x,y)
plt.xticks(rotation='vertical')
plt.grid(True)
plt.title("bar graph acc to highest loan amount")
plt.xlabel('Name of the Customer')
plt.ylabel("Loan Amount")
plt.show()
wait= input()
if ch==5:
g = df.groupby("SR.NO")
x = df['SR.NO'].unique()
y = g['Tenure'].sum()
plt.hist(x,)
plt.xticks(rotation=30)
plt.title("deptwise Tenure ")
plt.xlabel('dept')
plt.ylabel('Tenure')
plt.grid(True)
plt.show()
if ch==6:
break
def statistics():
df = pd.read_csv(csv_file)
while True:
clear()
print('\nData Statistics')
print('_'*100)
print('1. Count Vehicle name')
print('2. Maximum rate ')
print('3. sum of loan amount')
print('4. Average of loan amount')
print('5. Minimum rate')
print('6. exit')
ch = int(input('Enter your choice:' ))
if ch==1:
print(df['Vehicle name'].count())
wait=input()
if ch==2:
print(df['RATE'].max())
wait=input()
if ch==3:
print(df['Loan Amount'].sum())
wait=input()
if ch==4:
print(df['Loan Amount'].mean(axis=0))
wait=input()
if ch==5:
print(df['RATE'].min())
wait=input()
if ch==6:
break
def main_menu():
clear()
introduction()
while True:
clear()
print('MAIN MENU ')
print('_'*100)
print()
print('1. Read CSV File\n')
print('2. Data Analysis Menu\n')
print('3. Data Visualisation\n')
print('4. Data Statistics\n')
print('5. Exit\n')
choice = int(input('Enter your choice :'))
if choice==1:
print('Here Is Your Table')
read_csv_file()
wait=input()
if choice==2:
print('Opening Analysis Menu')
data_analysis_menu()
wait=input()
if choice==3:
graph()
wait=input()
if choice==4:
statistics()
wait=input()
if choice==5:
break
clear()
made_by()
# call your main menu
main_menu()