-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaddGeo.py
executable file
·57 lines (40 loc) · 1004 Bytes
/
addGeo.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
from importlib_metadata import csv
import pandas as pd
import random
csv1= pd.read_csv("dataalg1.csv")
src= pd.read_json("dzMap.json")
def getlat(src, id):
for e in src.features:
if e["properties"]["ID_1"]==id:
# print("oh")
return e["geometry"]["coordinates"][0][0][0]
def getlong(src, id):
for e in src.features:
if e["properties"]["ID_1"]==id:
# print("oh")
return e["geometry"]["coordinates"][0][0][1]
print(getlat(src, 1))
"""
print(csv1.shape[0])
wilaya = []
apis=[]
long=[]
lat=[]
text=csv1.text
csvdata=pd.DataFrame()
print(len(csv1))
for i in range(0,csv1.shape[0]):
n = random. randint(1,48)
api=random.randint(0,2)
long.append( getlong(src, n))
lat.append( getlat(src, n))
wilaya.append(n)
apis.append(api)
print(n)
csvdata["text"]=text
csvdata["Position"]=wilaya
csvdata["Api_type"]=apis
csvdata["latitude"]=lat
csvdata["long"]=long
csvdata.to_csv("dataset.csv")
"""