rendner / py-plugin-dataframe-viewer

Plugin for JetBrains IDEs to view Python DataFrames when debugging.
https://plugins.jetbrains.com/plugin/16050-python-styled-dataframe-viewer
Apache License 2.0
13 stars 1 forks source link
dataframe filtering intellij-plugin pandas polars pycharm sorting styler

Python: Styled DataFrame Viewer

[!NOTE] The plugin is broken in PyCharm 2024.2.1, but works again in PyCharm >= 2024.2.3.

In case of problems, you can use the following workaround: plugin fix

Installation

What It Is

View, sort and filter DataFrames or a Python dict when debugging.

Note: The plugin requires one of the supported Python DataFrame libraries:

preview of the plugin

Supported DataFrame Libraries

Features

How Does It Work

The plugin can be used to view DataFrames from a Debug Session or a Python Console.

Quick Example: Debug Session

Generate a DataFrame:

# code for pandas
import pandas as pd

df = pd.DataFrame.from_dict({"a": range(200), "b": range(100, 300), "c": range(200, 400)})

breakpoint()
# code for polars
import polars as pl

df = pl.from_dict({"a": range(200), "b": range(100, 300), "c": range(200, 400)})

breakpoint()

Run the code in debug mode in your JetBrains IDE. The program stops at the line with the breakpoint() command.

Select the Threads & Variables tab of the debugger (as seen in the screenshot below). Right-click on df to open the context menu. Select View as Styled DataFrame.

select view as action

This opens a new window which shows the DataFrame df:

DataFrame df

Quick Example: Python Console

Enter the code to generate a DataFrame:

# code for pandas
import pandas as pd

df = pd.DataFrame.from_dict({"a": range(200), "b": range(100, 300), "c": range(200, 400)})
# code for polars
import polars as pl

df = pl.from_dict({"a": range(200), "b": range(100, 300), "c": range(200, 400)})

Right-click on df, in the variable view, to open the context menu. Select View as Styled DataFrame.

select view as action

This opens a new window which shows the DataFrame df:

DataFrame df