-
Notifications
You must be signed in to change notification settings - Fork 290
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
Adding additional objects to Data Viewer; e.g. xarray arrays? #5590
Comments
Yes, and we welcome PRs 😊
I might be misreading this, is the proposal to add custom UI for manipulating xarray objects?
FWIW, if you wanted to pursue this approach, here are the changes to make: In this function: vscode-jupyter/pythonFiles/vscode_datascience_helpers/dataframes/vscodeDataFrame.py Lines 91 to 107 in 70a6e7b
elif hasattr(df, "__array__") and hasattr(vartype, "__name__") and vartype.__name__ == "DataArray":
df = _VSCODE_convertNumpyArrayToDataFrame(df.__array__(), start, end) (Depending on how And add 'DataArray' to the following three lists of supported types:
This should suffice to get support for viewing xarrays in the data viewer, including slicing xarrays. |
Solved by #6027 |
Currently Data Viewer works with a few objects — pandas' DataFrames, numpy arrays, TF & PyTorch tensors. It's v impressive! Would it be possible to add more types of objects?
It would be great to get xarray in there too (disclaimer: I'm a core dev). A couple of approaches:
__array__
methods and call that to return a numpy array. This extension doesn't need to know anything about the array for this to work, but we only get numpy functionality.Here's an example of
np.asarray
&__array__
working:The text was updated successfully, but these errors were encountered: