如何让DataFrame对象在VSCode调试控制台中显示为表?

2024-10-01 00:23:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我设置了一个断点并开始在调试控制台上键入。它似乎打印对象视图的字符串表示形式(在这个casse中是pandas.DataFrame)。是否有任何方法可以让对象像iPython中的表一样漂亮地显示出来

enter image description here

这是我的launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Debug Console",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        }
    ]
}

Tags: to对象方法字符串视图jsondataframepandas