MCPcopy
hub / github.com/ContextLab/hypertools / _load_example_data

Function _load_example_data

hypertools/tools/load.py:169–187  ·  view source on GitHub ↗
(dataset)

Source from the content-addressed store, hash-verified

167
168
169def _load_example_data(dataset):
170 dataset_path = DATA_DIR.joinpath(dataset)
171 if not dataset_path.is_file():
172 if not DATA_DIR.is_dir():
173 DATA_DIR.mkdir()
174 _download_example_data(dataset_path)
175
176 try:
177 geo_data = pickle.loads(dataset_path.read_bytes())
178 except Exception as e:
179 raise HypertoolsIOError(
180 f"Failed to load '{dataset}' data. Try deleting cached file at"
181 f"{dataset_path} and reloading."
182 ) from e
183
184 if dataset == 'mushrooms':
185 # format mushrooms dataset as a pandas DataFrame
186 geo_data.data = pd.DataFrame(geo_data.data)
187 return geo_data
188
189
190def _download_example_data(dataset_path):

Callers 1

loadFunction · 0.85

Calls 2

_download_example_dataFunction · 0.85
HypertoolsIOErrorClass · 0.85

Tested by

no test coverage detected