You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run a SPARQL SELECT query against Neptune using AWS SDK for Pandas, if one of the values is null, I get an error:
File ~/anaconda3/envs/JupyterSystemEnv/lib/python3.10/site-packages/awswrangler/neptune/_neptune.py:116, in execute_sparql..(d)
114 if "results" in data and "bindings" in data["results"]:
115 df = pd.DataFrame(data["results"]["bindings"], columns=data.get("head", {}).get("vars"))
--> 116 df = df.applymap(lambda d: d["value"] if "value" in d else None)
117 else:
118 df = pd.DataFrame(data)
TypeError: argument of type 'float' is not iterable
How to Reproduce
I wrap SDK call in a function run_sparql_introspect as follows
import awswrangler as wr
import pandas as pd
import igraph as ig
import graph_notebook as gn
from graph_notebook.configuration.generate_config import AuthModeEnum
# Get the configuration information for the notebook
config = gn.configuration.get_config.get_config()
iam=True if config.auth_mode==AuthModeEnum.IAM else False
# Retrieve Data from neptune
client = wr.neptune.connect(config.host, config.port, iam_enabled=iam)
def run_sparql_introspect(query):
df = wr.neptune.execute_sparql(client, query)
#display(df.head(10))
return df
Describe the bug
When I run a SPARQL SELECT query against Neptune using AWS SDK for Pandas, if one of the values is null, I get an error:
File ~/anaconda3/envs/JupyterSystemEnv/lib/python3.10/site-packages/awswrangler/neptune/_neptune.py:116, in execute_sparql..(d)
114 if "results" in data and "bindings" in data["results"]:
115 df = pd.DataFrame(data["results"]["bindings"], columns=data.get("head", {}).get("vars"))
--> 116 df = df.applymap(lambda d: d["value"] if "value" in d else None)
117 else:
118 df = pd.DataFrame(data)
TypeError: argument of type 'float' is not iterable
How to Reproduce
I wrap SDK call in a function run_sparql_introspect as follows
I run a SPARQL query as follows.
In the result, sometimes objType is null. That's ok, it is optional. But SDK execute_sparql throws error.
Expected behavior
No response
Your project
No response
Screenshots
No response
OS
Amazon Linux 2
Python version
3.10.8
AWS SDK for pandas version
3.6.0
Additional context
No response
The text was updated successfully, but these errors were encountered: