-
Notifications
You must be signed in to change notification settings - Fork 12
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
Data Explorer breaks when dataframe cell has complex data in it #36
Comments
@emeeks Is this ringing any bells for you? |
From what I understand, the problem is that whatever values inside "data" in the output are being inserted as children into the React component from a cell, and the problem arises when the data is a dictionary. So I'm thinking that currently, the
is just being inlined in React, but probably should be turned into a string first before inlining |
I was able to reproduce @jruales's issue outside of Jupyter. The issue persists regardless when the schema type is set to Demo: https://codesandbox.io/s/pedantic-hodgkin-78o80?file=/src/App.js:216-221 @emeeks what do you think about changing
|
🚀 Issue was released in |
Reopening since while #65 fixes the issue for Javascript consumers when the schema type for these complex columns is set to |
I tried to reproduce this issue in my local jupyterlab, but found it wasn't working with the latest version. I think the data-explorer package (which hasn't been updated in a year) is getting the data in from here, but I'm not sure how to track where the frictionless data spec is generated (perhaps it is coming from something in the Python code). Once we do, we'll want to find a way to get it to set the column type properly (Pandas has it correctly set as an object based on the screencap below) @jruales did you run into this issue while using Jupyter Lab or Jupyter Notebook? |
I decided to have a look at the Pandas documentation, and found the root of the issue. https://pandas.pydata.org/docs/user_guide/io.html#table-schema The column type for a Pandas I think we actually want this to be returning a Frictionless During the serialization/deserialization process to Jupyter, the string contents were turned back into a JSON object, as it's no longer a string by the time it reaches the df = DataFrame(
{
"A": ["a", "b", "c"],
"B": [{ "a": 1}, { "b": 1}, { "c": 1}]
}
)
col_types = df.dtypes
# strings and object columns are treated the same way in Pandas
col_types[0] == col_types[1] # this returns true :( This issue was brought up when Table Schema was implemented in Pandas, but ultimately There might be a "sniffing heuristic" that we could apply at the Javascript or Python level, where if a column is labeled as a |
Repro: run the following in a cell
Then the following error appears (with a link to this error page, which mentions that the error was
Objects are not valid as a React child (found: object with keys {name}). If you meant to render a collection of children, use an array instead.
)For reference, this is how Pandas would normally render the cell, when setting
pd.set_option("display.html.table_schema", False)
Finally, here's what the output looks like in the ipynb file when the error occurs
The text was updated successfully, but these errors were encountered: