question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error while trying to view a 3 dimensional numpy array

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
IanMatthewHuffcommented, Jun 9, 2020

@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.

1reaction
joyceerhlcommented, Mar 31, 2021

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/

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found