citylearn.utilities module

citylearn.utilities.join_url(*args: str) str[source]
citylearn.utilities.read_json(filepath: str, **kwargs) dict[source]

Return JSON document as dictionary.

Parameters:
  • filepath (str) – pathname of JSON document.

  • **kwargs (dict) – Other infrequently used keyword arguments to be parsed to simplejson.load.

Returns:

JSON document converted to dictionary.

Return type:

dict

citylearn.utilities.read_pickle(filepath: str, **kwargs) Any[source]

Return pickle file as some Python class object.

Parameters:
  • filepath (str) – pathname of pickle file.

  • **kwargs (dict) – Other infrequently used keyword arguments to be parsed to pickle.load.

Returns:

Pickle file as a Python object.

Return type:

Any

citylearn.utilities.read_yaml(filepath: str) dict[source]

Return YAML document as dictionary.

Parameters:

filepath (str) – pathname of YAML document.

Returns:

YAML document converted to dictionary.

Return type:

dict

citylearn.utilities.write_json(filepath: str, dictionary: dict, **kwargs)[source]

Write dictionary to JSON file.

Parameters:
  • filepath (str) – pathname of JSON document.

  • dictionary (dict) – dictionary to convert to JSON.

  • **kwargs (dict) – Other infrequently used keyword arguments to be parsed to simplejson.dump.

citylearn.utilities.write_pickle(filepath: str, data: Any, **kwargs)[source]

Write Python object to pickle file.

Parameters:
  • filepath (str) – pathname of pickle document.

  • data (dict) – object to convert to pickle.

  • **kwargs (dict) – Other infrequently used keyword arguments to be parsed to pickle.dump.

citylearn.utilities.write_yaml(filepath: str, dictionary: dict, **kwargs)[source]

Write dictionary to YAML file.

Parameters:
  • filepath (str) – pathname of YAML document.

  • dictionary (dict) – dictionary to convert to YAML.

  • **kwargs (dict) – Other infrequently used keyword arguments to be parsed to yaml.safe_dump.