aws / aws/graph-notebook

Improve support for numeric datatypes

Open
#707 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Jupyter Notebook
Stars
819
Forks
179
PR merge metrics
No merged PRs in 30d

Description

**Community Note**
* Please use a 👍 reaction to provide a +1/vote. This helps the community and maintainers prioritize this request.
* If you are interested in working on this issue or have submitted a pull request, please leave a comment.

**Graph Notebook Version (and Graph Database and Version used if applicable)**
4.6.0 (Amazon Neptune 1.2.1.0)

**Is your feature request related to a problem? Please describe.**
When I use the `%%sparql` magic with `--store-to` and `--store-format` parameters to store the results of a SPARQL SELECT query to a dataframe, all the values in the dataframe are handled as strings, whilst the RDF literals have standard XSD datatypes like `xsd:integer` or `xsd:decimal`.

**Describe the solution you'd like**
When processing the results of a SELECT query, add handling for standard XSD datatypes that can be handled as numerics in a dataframe.

Also add error handling if the lexical value cannot be interpreted according to the datatype. For example a typed literal like `"example"^^` may occur in RDF data, but the value cannot be interpreted as an integer. Could fallback to string in such cases.

**Additional context**
Workaround is to add a post-processing step to convert values from string to numeric for each variable/field where we expect numeric values:

```python
df.x = pd.to_numeric(df.x, errors='coerce')
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.