classrooms module#
- class classrooms.Address(**kwargs: str)[source]#
Bases:
objectAddress object made from informations retrieved via ADE API.
- Parameters
kwargs (str) – dict with minimal entries (can be None): - address1 - zipCode - city - country
- Example
>>> informations = dict(address1='Rue Rose 42', zipCode='1300', city='Wavre', country='Belgique') >>> address = Address(**informations)
- class classrooms.Classroom(**kwargs: Union[str, classrooms.Address])[source]#
Bases:
objectClassroom object containing the address (as string or Address object), the name of the classroom and its id.
Its main purpose is be used with
location().
- classrooms.get_geo_locations() Dict[source]#
Returns the dictionary mapping each address to its geo-location.
- Returns
the geo-locations
- Return type
Dict
- classrooms.merge_classrooms(classrooms: Iterable[classrooms.Classroom]) classrooms.Classroom[source]#
Merges multiple classrooms into one.
- Parameters
classrooms (Iterable[Classroom]) – multiple classrooms
- Returns
the new classroom
- Return type
- Example
>>> c1 = Classroom(address1, 'classA', 1) >>> c2 = Classroom(address2, 'classB', 2) >>> c3 = merge_classrooms((c1, c2))
- classrooms.prettify_classrooms(classrooms: pandas.core.frame.DataFrame, sleep: float = 0) pandas.core.frame.DataFrame[source]#
Returns the classrooms dataframe in a pretty format, useful when need to display.
The function will request, for every different address, a geo-localisation, so it can take some times. If too many requests are done, Nominatim will not like it so prefer to put a time.sleep between each request.
- Parameters
classrooms (pd.DataFrame) – the classrooms with fields defined in backend.resources.py
sleep (float) – the sleep duration between each address request
- Returns
the classrooms in a prettier format and with geo-location information
- Return type
pd.DataFrame