Python中的熊猫系列并没有显示完整的输出?

时间:2018-02-05 21:24:12

标签: python pandas

我的代码是:

import sys
import time
import select
import paramiko
import pandas as pd

paramiko.util.log_to_file('paramiko.log')
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('localhost', username='red', password='******')
stdin, stdout, stderr = ssh.exec_command("last")
out = stdout.read()

print(pd.Series(out, index=['1', '2', '3', '4', '5']))

输出is this one

你可以看到,在星期二之后......它只是停下来而且没有显示任何其他内容。终端中的输出完全不同,因为它显示了这个

red      pts/2        127.0.0.1        Tue Feb  6 02:12 - 03:45  (01:32)
red      tty1         /dev/tty1        Tue Feb  6 01:24   still logged in
reboot   system boot  4.13.0-32-generi Tue Feb  6 01:24   still running
red      tty1         /dev/tty1        Tue Feb  6 01:04 - 01:07  (00:03)
reboot   system boot  4.13.0-32-generi Tue Feb  6 01:04 - 01:07  (00:03)
red      tty1         /dev/tty1        Sat Feb  3 10:29 - crash (2+14:35)
reboot   system boot  4.13.0-32-generi Sat Feb  3 10:28 - 01:07 (2+14:38)
red      tty1         /dev/tty1        Sat Feb  3 08:10 - 10:10  (01:59)
reboot   system boot  4.13.0-32-generi Sat Feb  3 08:10 - 10:10  (02:00)
red      tty1         /dev/tty1        Fri Feb  2 04:35 - 21:27  (16:51)
reboot   system boot  4.13.0-32-generi Fri Feb  2 04:35 - 21:27  (16:51)
red      tty1         /dev/tty1        Fri Feb  2 03:10 - 04:35  (01:24)
reboot   system boot  4.13.0-21-generi Fri Feb  2 03:10 - 04:35  (01:24)

wtmp begins Fri Feb  2 03:10:22 2018

1 个答案:

答案 0 :(得分:1)

将选项max_colwidth设置为-1将显示完整输出。

pd.set_option('display.max_colwidth', -1)