Skip to content

rendner/py-plugin-dataframe-viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python: Styled DataFrame Viewer

Warning

The plugin is broken in PyCharm 2024.2.1, because of a bug in PyCharm.

You can use the following workaround until the bug is fixed: plugin fix

Installation

What It Is

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

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

  • pandas
  • polars (experimental)

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 (experimental).

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 (experimental)

Note: Filtering is currently not implemented for the 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