Closed
Description
The body_fat.csv
from pm.get_data("body_fat.csv")
is not found.
───────────────────────────────────── Error running examples/diagnostics_and_criticism/model_averaging.ipynb ─────────────────────────────────────
---------------------------------------------------------------------------
Exception encountered at "In [4]":
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Cell In[4], line 2
1 try:
----> 2 d = pd.read_csv(os.path.join("..", "data", "body_fat.csv"))
3 except FileNotFoundError:
File ~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pandas/io/parsers/readers.py:1026, in read_csv(filepath_or_buffer, sep,
delimiter, header, names, index_col, usecols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows,
na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, date_format,
dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment,
encoding, encoding_errors, dialect, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options, dtype_backend)
1024 kwds.update(kwds_defaults)
-> 1026 return _read(filepath_or_buffer, kwds)
File ~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pandas/io/parsers/readers.py:620, in _read(filepath_or_buffer, kwds)
619 # Create the parser.
--> 620 parser = TextFileReader(filepath_or_buffer, **kwds)
622 if chunksize or iterator:
File ~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pandas/io/parsers/readers.py:1620, in TextFileReader.__init__(self, f, engine,
**kwds)
1619 self.handles: IOHandles | None = None
-> 1620 self._engine = self._make_engine(f, self.engine)
File ~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pandas/io/parsers/readers.py:1880, in TextFileReader._make_engine(self, f,
engine)
1879 mode += "b"
-> 1880 self.handles = get_handle(
1881 f,
1882 mode,
1883 encoding=self.options.get("encoding", None),
1884 compression=self.options.get("compression", None),
1885 memory_map=self.options.get("memory_map", False),
1886 is_text=is_text,
1887 errors=self.options.get("encoding_errors", "strict"),
1888 storage_options=self.options.get("storage_options", None),
1889 )
1890 assert self.handles is not None
File ~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pandas/io/common.py:873, in get_handle(path_or_buf, mode, encoding, compression,
memory_map, is_text, errors, storage_options)
871 if ioargs.encoding and "b" not in ioargs.mode:
872 # Encoding
--> 873 handle = open(
874 handle,
875 ioargs.mode,
876 encoding=ioargs.encoding,
877 errors=errors,
878 newline="",
879 )
880 else:
881 # Binary mode
FileNotFoundError: [Errno 2] No such file or directory: '../data/body_fat.csv'
During handling of the above exception, another exception occurred:
HTTPError Traceback (most recent call last)
Cell In[4], line 4
2 d = pd.read_csv(os.path.join("..", "data", "body_fat.csv"))
3 except FileNotFoundError:
----> 4 d = pd.read_csv(pm.get_data("body_fat.csv"))
6 d.head()
File ~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pymc/data.py:67, in get_data(filename)
55 def get_data(filename):
56 """Return a BytesIO object for a package data file.
57
58 Parameters
(...)
65 BytesIO of the data
66 """
---> 67 with urllib.request.urlopen(BASE_URL.format(filename=filename)) as handle:
68 content = handle.read()
69 return io.BytesIO(content)
File ~/micromamba/envs/pymc-examples/lib/python3.11/urllib/request.py:216, in urlopen(url, data, timeout, cafile, capath, cadefault, context)
214 else:
215 opener = _opener
--> 216 return opener.open(url, data, timeout)
File ~/micromamba/envs/pymc-examples/lib/python3.11/urllib/request.py:525, in OpenerDirector.open(self, fullurl, data, timeout)
523 for processor in self.process_response.get(protocol, []):
524 meth = getattr(processor, meth_name)
--> 525 response = meth(req, response)
527 return response
File ~/micromamba/envs/pymc-examples/lib/python3.11/urllib/request.py:634, in HTTPErrorProcessor.http_response(self, request, response)
631 # According to RFC 2616, "2xx" code indicates that the client's
632 # request was successfully received, understood, and accepted.
633 if not (200 <= code < 300):
--> 634 response = self.parent.error(
635 'http', request, response, code, msg, hdrs)
637 return response
File ~/micromamba/envs/pymc-examples/lib/python3.11/urllib/request.py:563, in OpenerDirector.error(self, proto, *args)
561 if http_err:
562 args = (dict, 'default', 'http_error_default') + orig_args
--> 563 return self._call_chain(*args)
File ~/micromamba/envs/pymc-examples/lib/python3.11/urllib/request.py:496, in OpenerDirector._call_chain(self, chain, kind, meth_name, *args)
494 for handler in handlers:
495 func = getattr(handler, meth_name)
--> 496 result = func(*args)
497 if result is not None:
498 return result
File ~/micromamba/envs/pymc-examples/lib/python3.11/urllib/request.py:643, in HTTPDefaultErrorHandler.http_error_default(self, req, fp, code, msg,
hdrs)
642 def http_error_default(self, req, fp, code, msg, hdrs):
--> 643 raise HTTPError(req.full_url, code, msg, hdrs, fp)
HTTPError: HTTP Error 404: Not Found
Metadata
Metadata
Assignees
Labels
No labels