(
meta: MetaEdge, data_parser: Callable, base_dir=None, separator=","
)
| 213 | |
| 214 | @staticmethod |
| 215 | def load_from_csv( |
| 216 | meta: MetaEdge, data_parser: Callable, base_dir=None, separator="," |
| 217 | ): |
| 218 | df = BaseData.read_csv(meta.file_name, base_dir, separator) |
| 219 | src_ids = BaseData.pop_from_dataframe(df, meta.src_id_field) |
| 220 | if src_ids is None: |
| 221 | raise DGLError( |
| 222 | "Missing src id field [{}] in file [{}].".format( |
| 223 | meta.src_id_field, meta.file_name |
| 224 | ) |
| 225 | ) |
| 226 | dst_ids = BaseData.pop_from_dataframe(df, meta.dst_id_field) |
| 227 | if dst_ids is None: |
| 228 | raise DGLError( |
| 229 | "Missing dst id field [{}] in file [{}].".format( |
| 230 | meta.dst_id_field, meta.file_name |
| 231 | ) |
| 232 | ) |
| 233 | graph_ids = BaseData.pop_from_dataframe(df, meta.graph_id_field) |
| 234 | etype = tuple(meta.etype) |
| 235 | edata = data_parser(df) |
| 236 | return EdgeData(src_ids, dst_ids, edata, type=etype, graph_id=graph_ids) |
| 237 | |
| 238 | @staticmethod |
| 239 | def to_dict(edge_data: List["EdgeData"], node_dict: dict) -> dict: |
nothing calls this directly
no test coverage detected