Spyder:按下 Tab 键时如何仅显示数据框列?

发布于 2025-01-17 19:23:01 字数 742 浏览 2 评论 0原文

我正在从matlab切换到python,我正面临第一个障碍。 :)

我有以下代码:

import pandas as pd
T = pd.read_csv("MyFile.csv", sep=';')

到目前为止,很好,但是我有两个问题:

  1. 在控制台中:当我键入t。时,然后我点击tab,我获取 all dataframe的列以及 asl 我可以在t上执行的可能命令。我应该如何才能列出 dataFrame列?
  2. 在编辑器中:当我键入t。后面是选项卡时,需要很长时间才能看到列出的任何内容。

我希望以下行为:当我键入t。然后点击选项卡(或其他键)时,我将列出唯一的然后,我可以使用键盘上的箭头键选择数据框。

我在Windows 10上使用Spyder 5.1.5通过Anaconda安装,我还安装了JEDI已安装不过是活动的,但是在spyder的底部,我可以看到lsp python:ready)。

I am switching from Matlab to Python and I am facing the first hurdles. :)

I have the following code:

import pandas as pd
T = pd.read_csv("MyFile.csv", sep=';')

So far, so good, but I have two problems:

  1. In the console: when I type T. and then I hit TAB, I get listed all the columns of the dataframe along with all the possible commands that I can perform on T. How should I do to get listed only the dataframe columns?
  2. In the editor: when I type T. followed by TAB, it takes long time before I see anything listed.

I wish the following behavior: when I type T. and then I hit TAB (or some other key) I shall get listed only the columns of the dataframe that I can then select by using the arrow keys on my keyboard.

I am running on Windows 10 with Spyder 5.1.5 installed through Anaconda and I also have jedi installed (but I don't know if it is active though, but on the bottom of Spyder I can see LSP Python: ready).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

°如果伤别离去 2025-01-24 19:23:02

我想您需要列名称。方法如下:

print(list(T.columns.values))

或者简单地说:

print(list(T))

此外,到目前为止,可能无法使用箭头键或任何其他键获取列名称。

我不太清楚你第二个问题的原因是什么。您可以查看这个。尽管它是关于 MacOS 的,但它可能会有所帮助。

I guess you need Column names. Here's how:

print(list(T.columns.values))

Or simply:

print(list(T))

Also, till now there might be no way to get column names with arrow keys or any other key.

I don't exactly know what could be the reason for your second question. You can take a look at this. Even though it's about MacOS but it might help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文