Dataframe head not shown in PyCharm

前端 未结 3 737
有刺的猬
有刺的猬 2021-02-18 22:43

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\')

         


        
相关标签:
3条回答
  • 2021-02-18 23:16

    I did File-Invalidate Caches/Restart Option Invalidate and after that I was able to get the head:

    screenshot of python console

    0 讨论(0)
  • 2021-02-18 23:17

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

    print(df.head(10))
    
    0 讨论(0)
  • 2021-02-18 23:17

    For printing all data

    print(df)

    By Default it will print top 5 records for head.

    print(df.head())

    If you need 10 rows then you can write this way

    print(df.head(10))

    0 讨论(0)
提交回复
热议问题