-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from thomcom/python-initial-code
[WIP] Python Initial Unit Testing and Bindings
- Loading branch information
Showing
20 changed files
with
681 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 11 additions & 11 deletions
22
python/cuspatial/cuspatial/demos/haversine_distance_test_nyctaxi.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import time | ||
import cudf | ||
from cudf.dataframe import columnops | ||
from cudf.core import column | ||
import cuspatial.bindings.spatial as gis | ||
|
||
start = time.time() | ||
#data dowloaded from https://s3.amazonaws.com/nyc-tlc/trip+data/yellow_tripdata_2009-01.csv | ||
# data dowloaded from https://s3.amazonaws.com/nyc-tlc/trip+data/yellow_tripdata_2009-01.csv | ||
df = cudf.read_csv("/home/jianting/hardbd19/data/nyctaxi/yellow_tripdata_2009-01.csv") | ||
end = time.time() | ||
print("data ingesting time (from SSD) in ms={}".format((end - start)*1000)) | ||
print("data ingesting time (from SSD) in ms={}".format((end - start) * 1000)) | ||
df.head().to_pandas().columns | ||
|
||
start = time.time() | ||
x1=columnops.as_column(df['Start_Lon']) | ||
y1=columnops.as_column(df['Start_Lat']) | ||
x2=columnops.as_column(df['End_Lon']) | ||
y2=columnops.as_column(df['End_Lat']) | ||
x1 = column.as_column(df["Start_Lon"]) | ||
y1 = column.as_column(df["Start_Lat"]) | ||
x2 = column.as_column(df["End_Lon"]) | ||
y2 = column.as_column(df["End_Lat"]) | ||
end = time.time() | ||
print("data frame to gdf column conversion time in ms={}".format((end - start)*1000)) | ||
print("data frame to gdf column conversion time in ms={}".format((end - start) * 1000)) | ||
|
||
start = time.time() | ||
h_dist=gis.cpp_haversine_distance(x1,y1,x2,y1) | ||
h_dist = gis.cpp_haversine_distance(x1, y1, x2, y1) | ||
end = time.time() | ||
print("python computing distance time in ms={}".format((end - start)*1000)) | ||
#h_dist.data.to_array() | ||
print("python computing distance time in ms={}".format((end - start) * 1000)) | ||
# h_dist.data.to_array() |
Oops, something went wrong.