PyCharm 2017.2 Help

Viewing as Array or DataFrame

Limitations

This command is available for:

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

Viewing as array or DataFrame

To use the command View as Array/View as DataFrame, follow these steps:

  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.
    /help/img/idea/2017.2/py_view_as_array.png

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

    The Data View tool window appears.

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

To view as array from the Python Console, follow these steps:

  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 /help/img/idea/2017.2/show-watches.png. 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:
      /help/img/idea/2017.2/py_view_as_array_from_console_link.png
    • On the context menu of a variable, choose View as Array/ View as DataFrame:
      /help/img/idea/2017.2/py_view_as_array_from_console.png

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 /help/img/idea/2017.2/close1.png, and open a new one by clicking /help/img/idea/2017.2/add.png.
  • 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 /help/img/idea/2017.2/cogwheel_black_with_arrow.png. If this command is cleared, and a new DataFrame/array is opened, then the new presentation will be colorless.
  • 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:
    /help/img/idea/2017.2/py_view_as_array_colorless.png
  • Resize columns using the double-headed arrow /help/img/idea/2017.2/double-headed-arrow-icon.png:
    /help/img/idea/2017.2/py_data_frame_tw.png

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 PyCharm Tool Windows to learn more.

See Also

Last modified: 9 August 2017