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.

Can't visualise 3D arrays with variables explorer

See original GitHub issue

Data science require visualising 3D arrays for testing/debugging purposes.

import numpy
array =  numpy.zeros((3,3,3))

When double clicking on the variable array in the variable explorer :

This array can’t be visualised in the variable explorer, only 2D arrays are allowed. Spyder displays it as a 2D array and allow to switch dimenssion and slice through the array. Not super intuitive at first but works and should be easy to implement. It’s just about extracting 2D from 3D.


Error: Failure during variable extraction:
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
c:\Users\Boris\Desktop\3Darray.py in <module>
     45         _VSCODE_df = _VSCODE_pd.Series.to_frame(_VSCODE_evalResult)
     46     elif _VSCODE_targetVariable['type'] == 'ndarray':
---> 47         _VSCODE_df = _VSCODE_pd.DataFrame(_VSCODE_evalResult)
     48 
     49     # If any rows, use pandas json to convert a single row to json. Extract

~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\core\frame.py in __init__(self, data, index, columns, dtype, copy)
    438                 mgr = init_dict({data.name: data}, index, columns, dtype=dtype)
    439             else:
--> 440                 mgr = init_ndarray(data, index, columns, dtype=dtype, copy=copy)
    441 
    442         # For data is list-like, or Iterable (will consume into list)

~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\core\internals\construction.py in init_ndarray(values, index, columns, dtype, copy)
    169     # by definition an array here
    170     # the dtypes will be coerced to a single dtype
--> 171     values = prep_ndarray(values, copy=copy)
    172 
    173     if dtype is not None:

~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\core\internals\construction.py in prep_ndarray(values, copy)
    293         values = values.reshape((values.shape[0], 1))
    294     elif values.ndim != 2:
--> 295         raise ValueError("Must pass 2-d input")
    296 
    297     return values

ValueError: Must pass 2-d input


Issue Analytics

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

github_iconTop GitHub Comments

1reaction
rchiodocommented, Mar 31, 2021
1reaction
rajkunducommented, Mar 31, 2021

Possible duplicate of #1145?

Read more comments on GitHub >

github_iconTop Results From Across the Web

why converted numpy array is NOT showing in the variable ...
When I tried to convert this column to numpy array by SMB=np.array(ff['SMB']) , it went through but didn't show in the variable explorer....
Read more >
Arrays - Visual Basic | Microsoft Learn
ReDim numbers(15) ' Declare a 6 x 6 multidimensional array. ... For additional examples, see How to: Initialize an Array Variable in Visual ......
Read more >
Variable Explorer not showing anything? - Google Groups
I am new to Python. Launched Spyder and typed a few lines of code from the book I am using. Sadly, my IDE...
Read more >
A complete guide to 3D visualization device system in R - Wiki
This R tutorial describes, step by step, how to build a 3D graphic using R software and the rgl package. You'll learn also...
Read more >
Origin Help - Project Explorer - OriginLab
You will see an upper/down arrow next to slide column header. Note: This step can not be skipped. With bottom panel sorted by...
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