0

Recently I moved from Matlab to python.

In Matlab, it is very convenient to check all the data content.

But in ipython, it is not the case. Besides using print() and saving to text file, is there any plugin or whatever that could check data the same way as Matlab's "Variable Bar"?

Sorry, I didn't make it clear. When the array size was large, print() or vars(),locals() mentioned by Baruchel would truncate the array like this even if there were non-zero values in the array:

'region': array([[0, 0, 0, ..., 0, 0, 0],
    [0, 0, 0, ..., 0, 0, 0],
    [0, 0, 0, ..., 0, 0, 0],
    ..., 
    [0, 0, 0, ..., 0, 0, 0],
    [0, 0, 0, ..., 0, 0, 0],
    [0, 0, 0, ..., 0, 0, 0]])

I searched and know that by setting the 'threshold' parameter to 'nan' would make print() print all the data out.

I am looking for something that will show the index and content in array without truncating. If there weren't any then I'll settle for print() or np.savetxt(). Just a little inconvenient.

Thanks for your time, Baruchel and Solo. I learned something new, but the magic command %who seems preferable to dir() for my purpose.

3 Answers3

0

You can use the dir() function. A nice post about the functionality: How to print all variables values when debugging Python with pdb, without specifying each variable?

Community
  • 1
  • 1
Solo
  • 389
  • 1
  • 10
0

You can use the vars() or locals() functions but the output isn't really nice.

Thomas Baruchel
  • 7,236
  • 2
  • 27
  • 46
0

The spyder Python IDE has a MATLAB-like interface, including a variable explorer.

TheBlackCat
  • 9,791
  • 3
  • 24
  • 31