-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUntitled1.py
112 lines (43 loc) · 1.16 KB
/
Untitled1.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
#!/usr/bin/env python
# coding: utf-8
# In[20]:
import pandas as pd
import numpy as np
# In[2]:
data = pd.read_csv("311_Service_Requests_from_2010_to_Present.csv")
# In[3]:
data.head()
# In[4]:
data.shape
# In[9]:
small_data = data[0:5000]
# In[12]:
small_data.describe()
# In[45]:
import datetime
print(datetime.datetime.now())
# In[49]:
pd.to_datetime(small_data["Created Date"][0]).year
# In[ ]:
# In[56]:
small_data["Created Date"][0:10]
# In[ ]:
dd = data["Created Date"].apply(lambda x: pd.to_datetime(x, format="%m/%d/%Y %I:%M:%S %p"))
# In[ ]:
dd[0:10]
# In[51]:
small_data["Created Date"].apply(lambda x: x.date())
# In[31]:
import geopy.distance
coords_1 = np.array( [52.2296756, 21.0122287] )
coords_2 = np.array( [52.406374, 16.9251681] )
print(geopy.distance.vincenty(coords_1, coords_2).km)
print(np.square(coords_1 - coords_2).sum())
coords_1 = np.array( [51.2296756, 21.0122287] )
coords_2 = np.array( [51.406374, 16.9251681] )
print(geopy.distance.vincenty(coords_1, coords_2).km)
print(np.square(coords_1 - coords_2).sum())
# In[29]:
np.square(coords_1 - coords_2).sum()
# In[ ]:
data.describe()