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

Exercise "Add an additional datasource" refers to missing load_json() function #408

Open
svenvanderburg opened this issue Nov 19, 2024 · 2 comments

Comments

@svenvanderburg
Copy link
Collaborator

The exercise "Add an additional datasource" is broken:

https://carpentries-incubator.github.io/python-intermediate-development/33-code-decoupling-abstractions/index.html#exercise-add-an-additional-datasource

It refers to a function load_json that is missing from the models.py. This is the function:

def load_json(filename):
    """Load a numpy array from a JSON document.

    Expected format:
    [
        {
            observations: [0, 1]
        },
        {
            observations: [0, 2]
        }
    ]

    :param filename: Filename of CSV to load

    """
    with open(filename, 'r', encoding='utf-8') as file:
        data_as_json = json.load(file)
        return [np.array(entry['observations']) for entry in data_as_json]
svenvanderburg added a commit to esciencecenter-digital-skills/python-intermediate-development-gitlab that referenced this issue Nov 19, 2024
@svenvanderburg
Copy link
Collaborator Author

See suggested fix here: esciencecenter-digital-skills@7214c9b

@svenvanderburg
Copy link
Collaborator Author

Duplicate of #366 (but maybe we should keep this one, since it has a proposed solution)

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