简体   繁体   中英

Pandas DataFrame does not display correctly in Jupyter Notebook

I want to read one csv file into Jupyter Notebook with Python's Pandas lib. I have uploaded .csv file into jupyter notebook, and I wrote a code, but I think that my dataframe does not display correctly. This is the code for reading the file:

df = pd.read_csv('text analysis.csv')
print(df)

And my output, when I print that dataframe looks like this:

       avg title word len.  avg text word len.  avg sent. len.  \
0                     5.20                4.27           11.00   
1                     4.69                4.98           26.20   
2                     5.50                4.53           21.62   
3                     4.82                4.42           15.10   
4                     6.40                5.07           36.50   
...                    ...                 ...             ...   
34205                 4.29                4.96           24.60   
34206                 4.67                4.58           13.00   
34207                 4.92                5.08           26.79   
34208                 4.09                4.72           22.23   
34209                 4.75                5.76           18.38 

I have seen much better representation on JN, with all cells. This looks worse then when I print dataframe in idle

尝试使用display()插入print()并检查它。

Use this to your code.

pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
pd.set_option('display.max_colwidth', -1)

This sets it to dispay the entire dataframe.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM