Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces the
DataCommonsClientclass to interact with the Data Commons API, along with various utility functions and tests.DataCommonsClient
The DataCommonsClient class would be the main entry point for most users. As described in the design doc:
This implementation achieves those objectives but it shouldn't be seen as the end state of the class. The ultimate aim is to provide a range of convenience tools and functionality. For now, I wanted to keep this PR small and focused around defining how it will all come together, including clearly showcasing how the optional Pandas dependency will work.
For example, connecting to base DC:
And using that client, getting all property labels for a given node (docs example)
Which returns a
NodeResponseobject with the API responseOr which can produce a flatted list of properties for each entity:
As another example, getting statistical observations as a Pandas DataFrame from a custom DC instance
That will return a pandas Data Frame shaped as follows
Or we could also get all data for African countries for a specific indicator.
A lot of convenient features are possible but this PR does not incorporate them (the subject of future PRs)...
These examples are just scratching the surface to showcase the idea. Let me know if more would be helpful!