Error while trying to view a 3 dimensional numpy array
See original GitHub issueSteps to cause the bug to occur
- Open Python Interactive’s variables table
- 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
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Python : Numpy memory error on creating a 3d array. Whats ...
1) You seem to have a very sparse matrix even though the size is large. So you can try to use one of...
Read more >Python IndexError: too many indices for array - STechies
This error is thrown by Python 'numpy array' library when you try to access a single-dimensional array into multiple dimensional arrays. Example #...
Read more >Accessing Data Along Multiple Dimensions in an Array
NumPy is able to see the repeated structure among the list-of-lists-of-numbers passed to np.array , and resolve the two dimensions of data, which...
Read more >The N-dimensional array (ndarray) — NumPy v1.24 Manual
The number of dimensions and items in an array is defined by its shape ... help find errors when incorrectly relying on the...
Read more >numpy.tile — NumPy v1.24 Manual
So a shape (3,) array is promoted to (1, 3) for 2-D replication, or shape (1, 1, ... Note : Although tile may...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
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/