-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
69 lines (57 loc) · 2.15 KB
/
main.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
# Load the Pandas libraries with alias 'pd'
import pandas as pd
# Read data from file 'filename.csv'
# (in the same directory that your python process is based)
# Control delimiters, rows, column names with read_csv (see later)
data = pd.read_csv("automobile.csv")
# Preview the first 5 lines of the loaded data
name = data['NAME'].tolist()
phone = data['Phone'].tolist()
dist = data['distance'].tolist()
def Convert(string):
li = list(string.split(","))
return li
user = input('Query: ') #query input "help" here means choosing book a service in our website
help1 = ["help","Help","HELP"]
string1 = "Available peeps : "
newname = ','.join(map(str,name))
distance = ','.join(map(str,dist))
newdist = distance.replace('m', '')
names = newname.replace(',', ', ') #names of available peeps
#neww = newding.split("delimiter")
aa = Convert(newdist)
listn = [] #index number of distances within 1 km radius
for inn in aa:
if int(inn) < 1000:
listn.append(aa.index(inn))
#litnew = listn.sort()
cldistance = ','.join(map(str,listn))
#print(listn)
newlist = [] #names of peoples available distances within 1 km radius
for varr in name:
for num in listn:
if name.index(varr) == num:
newlist.append(name[num])
newlist2 = [] #mob number of peoples available distances within 1 km radius
for var2 in phone:
for num in listn:
if phone.index(var2) == num:
newlist2.append(phone[num])
newlist3 = []# mob and name combined
for varr in newlist:
for var2 in newlist2:
if phone.index(var2) == name.index(varr):
newlist3.append(varr + " : " + var2)
#print(newlist3)
sortednames = ','.join(map(str,newlist3))
snames = sortednames.replace(',', ', ')#names of peoples available distances within 1 km radius in string format
#print(sortednames)
#actionimplemented after booking a service for ar mechanic
for ele in help1:
if user == ele:
user2 = input('Emergency Service (Y/N): ')
if user2 == "Y" or user2 == "y":
print(string1 + names)
print("Available within 1 km radius : " + snames)
else:
print(string1 + names)