Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_definitions fails if get_data wasn't called previously #47

Open
cherrywoods opened this issue May 7, 2024 · 0 comments
Open

get_definitions fails if get_data wasn't called previously #47

cherrywoods opened this issue May 7, 2024 · 0 comments

Comments

@cherrywoods
Copy link

Dear folktables developers,
Thank you for providing this useful and nicely usable package! However, I stumbled upon a minor issue when downloading definitions:

from folktables import ACSDataSource, load_acs

data_source = folktables.ACSDataSource("2018", "1-Year", "person", root_dir=".datasets/ACS")

data_source.get_definitions(download=True)
""" Throws the following error:
Traceback (most recent call last):
  File "/.../.local/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3553, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-6-365e0bfd702d>", line 1, in <module>
    cats = data_source.get_definitions(download=True)
  File "/.../lib/python3.10/site-packages/folktables/acs.py", line 65, in get_definitions
    return load_definitions(root_dir=self._root_dir, year=self._survey_year, horizon=self._horizon,
  File "/.../lib/python3.10/site-packages/folktables/load_acs.py", line 171, in load_definitions
    with open(file_path, 'wb') as handle:
FileNotFoundError: [Errno 2] No such file or directory: '.datasets/ACS/2018/1-Year/definition.csv'
"""
load_acs(root_dir=".datasets/ACS", serial_filter_list=[], download=True)
data_source.get_definitions(download=True)
# works fine now

Best regards,
David

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant