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

输出是这个

您可以看到,在周二之后...它只是停止而没有显示其他任何内容。当终端中的输出完全不同时,它显示了这一

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

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

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

最新更新