Skip to content
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

Error while trying to view a 3 dimensional numpy array #1145

Closed
soares7vinicius opened this issue Jun 9, 2020 · 5 comments
Closed

Error while trying to view a 3 dimensional numpy array #1145

soares7vinicius opened this issue Jun 9, 2020 · 5 comments
Labels
bug Issue identified by VS Code Team member as probable bug data-viewer

Comments

@soares7vinicius
Copy link

Steps to cause the bug to occur

  1. Open Python Interactive's variables table
  2. Click to view a 3D ndarray

Actual behavior

Get the following error:

Error: Failure during variable extraction: --------------------------------------------------------------------------- ValueError Traceback (most recent call last) ~/Documents/file.py in <module> 51 _VSCODE_df = _VSCODE_pd.Series.to_frame(_VSCODE_evalResult) 52 elif _VSCODE_targetVariable["type"] == "ndarray": ---> 53 _VSCODE_df = _VSCODE_pd.DataFrame(_VSCODE_evalResult) 54 elif hasattr(_VSCODE_df, "toPandas"): 55 _VSCODE_df = _VSCODE_df.toPandas() ~/anaconda3/envs/tcc/lib/python3.7/site-packages/pandas/core/frame.py in __init__(self, data, index, columns, dtype, copy) 462 mgr = init_dict({data.name: data}, index, columns, dtype=dtype) 463 else: --> 464 mgr = init_ndarray(data, index, columns, dtype=dtype, copy=copy) 465 466 # For data is list-like, or Iterable (will consume into list) ...

Expected behavior

Show the variable data

Jupyter and/or Python environment

  • Jupyter server running: Local
  • Extension version: 2020.5.86398
  • VS Code version: 1.45.1
  • Setting python.jediEnabled: true
  • Setting python.languageServer: Jedi
  • Python and/or Anaconda version: 3.7.7
  • OS: Linux Manjaro 19
  • Virtual environment: conda
@IanMatthewHuff
Copy link
Member

@soares7vinicius Thanks for reporting this, I repro the same thing. Right now our data viewer doesn't really handle 3D arrays, so it's not something that we currently support (but we are looking into this). But we should be providing a better error message here to inform users.

@RELNO
Copy link

RELNO commented Jul 20, 2020

Same here:
Screen Shot 2020-07-19 at 22 06 25

clicking the data viewer results with an error:

ValueError Traceback (most recent call last) XXX.py in <module> 51 _VSCODE_df = _VSCODE_pd.Series.to_frame(_VSCODE_evalResult) 52 elif _VSCODE_targetVariable["type"] == "ndarray": ---> 53 _VSCODE_df = _VSCODE_pd.DataFrame(_VSCODE_evalResult) 54 elif hasattr(_VSCODE_df, "toPandas"): 55 _VSCODE_df = _VSCODE_df.toPandas() ___PATH___/lib/python3.7/site-packages/pandas/core/frame.py in __init__(self, data, index, columns, dtype, copy) 462 mgr = init_dict({data.name: data}, index, columns, dtype=dtype) 463 else: --> 464 mgr = init_ndarray(data, index, columns, dtype=dtype, copy=copy) 465 466 # For data is list-like, or Iterable (will consume into list)...

@soares7vinicius
Copy link
Author

I think something like Spyder's array viewer could be implemented. In Spyder there is an option to select the axis to view.

@DonJayamanne DonJayamanne transferred this issue from microsoft/vscode-python Nov 13, 2020
@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug temp-improve-data-viewing-experience labels Nov 13, 2020
@rajkundu
Copy link

+1, This would be an awesome addition to offer the same functionality as (if not better than) Spyder

@joyceerhl
Copy link
Contributor

You can now inspect multidimensional tensors and ndarrays in the Jupyter extension's data viewer as of the April 2021 release: https://devblogs.microsoft.com/python/jupyter-in-visual-studio-code-april-2021-release/

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug data-viewer
Projects
None yet
Development

No branches or pull requests

7 participants