MCPcopy
hub / github.com/microsoft/qlib / _maybe_load_raw_data

Method _maybe_load_raw_data

qlib/data/dataset/loader.py:271–288  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

269 return df.loc[start_time:end_time]
270
271 def _maybe_load_raw_data(self):
272 if self._data is not None:
273 return
274 if isinstance(self._config, dict):
275 self._data = pd.concat(
276 {fields_group: load_dataset(path_or_obj) for fields_group, path_or_obj in self._config.items()},
277 axis=1,
278 join=self.join,
279 )
280 self._data.sort_index(inplace=True)
281 elif isinstance(self._config, (str, Path)):
282 if str(self._config).strip().endswith(".parquet"):
283 self._data = pd.read_parquet(self._config, engine="pyarrow")
284 else:
285 with Path(self._config).open("rb") as f:
286 self._data = pickle.load(f)
287 elif isinstance(self._config, pd.DataFrame):
288 self._data = self._config
289
290
291class NestedDataLoader(DataLoader):

Callers 1

loadMethod · 0.95

Calls 3

load_datasetFunction · 0.90
sort_indexMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected