crime module

class crime.Crime(bounds: geopandas.geodataframe.GeoDataFrame, crime_api: pandas.core.frame.DataFrame)[source]

Bases: object

distance_between(agent) → int[source]

Euclidean distance between two geographic points.

The output represents the distance referring to the geographic unit of the projection used.

Args:

agent (Police): A police object with coordinates xy.

Returns:

int: Distance with values associated with the projection.

DOCTESTS: >>> a = pd.DataFrame(); b = pd.DataFrame() >>> a.x = 1; a.y = 1 >>> b.x = 1; b.y = 1 >>> Crime.distance_between(a, b) 0.0

>>> a = pd.DataFrame(); b = pd.DataFrame()
>>> a.x = 10; a.y = 1
>>> b.x = 1; b.y = 1
>>> Crime.distance_between(a, b)
9.0
>>> a = pd.DataFrame(); b = pd.DataFrame()
>>> a.x = 1; a.y = 1
>>> b.x = 1; b.y = 10
>>> Crime.distance_between(a, b)
9.0
solve(police_list)[source]

Solve a crime by proximity to police.

A crime is determined to be solved if within a specified distance from a police officer, and given a random 50% chance.

Args:

police_list ([TODO:type]): [TODO:description]