数据框头未在PyCharm中显示 [英] Dataframe head not shown in PyCharm

查看:63
本文介绍了数据框头未在PyCharm中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PyCharm中有以下代码

I have the following code in PyCharm

import pandas as pd

import numpy as np

import matplotlib as plt

df = pd.read_csv("c:/temp/datafile.txt", sep='\t')

df.head(10)

我得到以下输出:

Process finished with exit code 0

我应该获取数据文件的前十行,但是这些行不会出现在 PyCharm 中。

I am supposed to get the first ten rows of my datafile, but these do not appear in PyCharm.

我检查了Project解释器,所有设置似乎都在那里。在正确的Python版本下安装了正确的软件包(numpy,pandas,matplotlib)。

I checked the Project interpreter and all settings seem to be alright there. The right packages are installed (numpy, pandas, matplotlib) under the right Python version.

我在做什么错?谢谢。

推荐答案

PyCharm 不是 Python Shell 会自动打印所有结果。您必须使用 print()来显示任何内容。

PyCharm is not Python Shell which automatically prints all results. You have to use print() to display anything.

print(df.head(10))

这篇关于数据框头未在PyCharm中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆