PyCharm 2019.2 Help

Viewing as Array or DataFrame

Limitations

This command is available for:

Hence, NumPy or pandas must be downloaded and installed in your Python interpreter.

Viewing as array or DataFrame

From the Variables tab of the Debug tool window

  1. Launch the debugger session.

  2. In the Variables tab of the Debug tool window, select an array or a DataFrame.

  3. Click a link View as Array/View as DataFrame to the right.

    View array or data frame

    Alternatively, you can choose View as Array or View as DataFrame from the context menu.

    The Data View tool window appears.

One can also use the command View as Array from the Python console.

From the Python console

  1. Launch the Python Console.

  2. Execute a Python code, for example:

    import pandas as pd import numpy as np array = np.random.random((36, 36)) array1 = np.random.random((36, 10)) df = pd.DataFrame(array) df2 = pd.DataFrame(array1) print("Put breakpoint here") df[0][0] = 1 print("The End")

  3. In the toolbar of the console, click Watch variables. The variables declared in the console, appear to the right.

  4. Do one of the following:

    • Click the link View as Array/View as DataFrame:

      Viewing variables in array when running from Python console

    • F rom the context menu of a variable, choose View as Array/ View as DataFrame:

      Viewing variables in data frames when running from Python console

Actions available via the Data View tool window

In the Data View tool window, one can do the following:

  • Change the format of presentation. For example, if in the Format field one specifies %.5f, then 5 digits will appear after dot; if one specifies %.2f, the presentation of the data will change to showing 2 digits after dot. See Python documentation for details.

  • Close the viewer tab by clicking Remove a tab, and open a new one by clicking Add a tab.

  • Make the presentation black-and-white in the new tabs by clearing the check-command Colored by Default that appears in the drop-down menu Window settings. If this command is cleared, and a new DataFrame/array is opened, then the new presentation will be colorless.

    Data view tables are colored by default

  • It's possible to change from the colored to colorless modes for the current tab by right-clicking a tab and selecting the check-command Colored:

    View a single data tab colorless

  • Resize columns using the double-headed arrow Resizing table columns:

Data View is a tool window, and as such, it inherits all the behaviors that are common to all the tool windows. Refer to the section Working with Tool Windows to learn more.

Last modified: 6 November 2019