9.4.2. aequilibrae.AequilibraeData

class aequilibrae.AequilibraeData

Bases: object

AequilibraE dataset

__init__()

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__()

Initialize self.

create_empty([file_path, entries, …])

Creates a new empty dataset

export(file_name[, table_name])

Exports the dataset to another format.

load(file_path)

Loads dataset from file

random_name()

Returns a random name for a dataset with root in the temp directory of the user

__init__()

Initialize self. See help(type(self)) for accurate signature.

create_empty(file_path=None, entries=1, field_names=None, data_types=None, memory_mode=False)

Creates a new empty dataset

Args:

file_path (str, Optional): Full path for the output data file. If memory_false is ‘false’ and path is missing, then the file is created in the temp folder

entries (int, Optional): Number of records in the dataset. Default is 1

field_names (list, Optional): List of field names for this dataset. If no list is provided, the field ‘data’ will be created

data_types (np.dtype, Optional): List of data types for the dataset. Types need to be NumPy data types (e.g. np.int16, np.float64). If no list of types are provided, type will be np.float64

memory_mode (bool, Optional): If true, dataset will be kept in memory. If false, the dataset will be a memory-mapped numpy array

vectors = "D:/release/Sample models/Chicago_2020_02_15/vectors.aed"
args = {
     "file_path": vectors,
     "entries": vec_1.shape[0],
     "field_names": ["origins", "destinations"],
     "data_types": [np.float64, np.float64],
 }
dataset = AequilibraeData()
dataset.create_empty(**args)
load(file_path)

Loads dataset from file

Args:

file_path (str): Full file path to the AequilibraeData to be loaded

dataset = AequilibraeData()
dataset.load("D:/datasets/vectors.aed")
export(file_name, table_name='aequilibrae_table')

Exports the dataset to another format. Supports CSV and SQLite

Args:

file_name (str): File name with PATH and extension (csv, or sqlite3, sqlite or db)

table_name (str): It only applies if you are saving to an SQLite table. Otherwise ignored

dataset = AequilibraeData()
dataset.load("D:/datasets/vectors.aed")
dataset.export("D:/datasets/vectors.csv")
static random_name()

Returns a random name for a dataset with root in the temp directory of the user

  name = AequilibraeData().random_name()
'/tmp/Aequilibrae_data_5werr5f36-b123-asdf-4587-adfglkjhqwe.aed'