Search code examples
eclipsedebuggingpydev

Eclipse IDE: How to create a view of a subset of my code's variables when debugging?


I'm using Eclipse (Neon.3 Release (4.6.3)) with PyDev plugin for Python.

The code I'm debugging has a large number of variables, many of which are nested within other variables. I'd like to select a subset of these variables to be included in a separate view so I can bypass having to drill down into the variables at each step, which is often a tedious process.

The primary data structure being used is a pandas DataFrame containing numerous columns, and I typically need to see only a small portion of the values from a few of the DataFrame's columns.

For example, let's say I have a DataFrame 'df' with a column named 'X'. Whenever I debug this code I want to see the values of df.X between indices i and j (i.e. df.X[i:j+1]). i and j may change from time to time as they're also variables in the code but not in 'df'. So how can I create a streamlined tab/view of variables that only includes df.X._values[i:j+1], preferably separate from the standard Variables view?


Solution

  • This can be done by using the 'Expressions' view within the Debug perspective.

    For the example in the question above I can add the following expression to see only what I want:

    list(df.X._values[i:j+1])