输出不完全在Python中显示

时间:2016-09-18 11:57:13

标签: python

运行简单代码时的输出中断并且未完全显示。有什么方法可以避免休息?

22     December 23, 1989, Saturday, Late Edition - Final
23       December 22, 1989, Friday, Late Edition - Final
24     December 21, 1989, Thursday, Late Edition - Final
25     December 21, 1989, Thursday, Late Edition - Final
26     December 20, 1989, Wednesday, Late Edition - F...
27     December 20, 1989, Wednesday, Late Edition - F...
28      December 19, 1989, Tuesday, Late Edition - Final
29       December 18, 1989, Monday, Late Edition - Final
                             ...                        
605                             January 12, 2016 Tuesday
606                January 12, 2016 Tuesday 10:58 PM EST
607                 January 12, 2016 Tuesday 8:28 PM EST
608                 January 12, 2016 Tuesday 9:43 AM EST

谢谢!

PD:这是用于生成文件的代码:

import json
import nltk
import re
import pandas

appended_data = []

for i in range(1989,2017):
    df0 = pandas.DataFrame([json.loads(l) for l in open('NYT_%d.json' % i)])
    df1 = pandas.DataFrame([json.loads(l) for l in open('USAT_%d.json' % i)])
    df2 = pandas.DataFrame([json.loads(l) for l in open('WP_%d.json' % i)])
    appended_data.append(df0)
    appended_data.append(df1)
    appended_data.append(df2)


appended_data = pandas.concat(appended_data)

print(appended_data.date)

1 个答案:

答案 0 :(得分:2)

您需要更改pandas的显示宽度。您正在寻找的选项是pd.set_option('display.width', 2000),但您也可以找到其他一些有用的pandas选项,我会定期使用它们:

pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.width', 2000)

详细说明可以here