zoukankan      html  css  js  c++  java
  • 3-7显示设置

    In [1]:
    import pandas as pd
    
     

    1-1显示最大的行数

    In [2]:
    pd.get_option('display.max_rows')
    
    Out[2]:
    60
    In [3]:
    pd.Series(index=range(0,100))#此集合只能显示60行
    
    Out[3]:
    0    NaN
    1    NaN
    2    NaN
    3    NaN
    4    NaN
    5    NaN
    6    NaN
    7    NaN
    8    NaN
    9    NaN
    10   NaN
    11   NaN
    12   NaN
    13   NaN
    14   NaN
    15   NaN
    16   NaN
    17   NaN
    18   NaN
    19   NaN
    20   NaN
    21   NaN
    22   NaN
    23   NaN
    24   NaN
    25   NaN
    26   NaN
    27   NaN
    28   NaN
    29   NaN
          ..
    70   NaN
    71   NaN
    72   NaN
    73   NaN
    74   NaN
    75   NaN
    76   NaN
    77   NaN
    78   NaN
    79   NaN
    80   NaN
    81   NaN
    82   NaN
    83   NaN
    84   NaN
    85   NaN
    86   NaN
    87   NaN
    88   NaN
    89   NaN
    90   NaN
    91   NaN
    92   NaN
    93   NaN
    94   NaN
    95   NaN
    96   NaN
    97   NaN
    98   NaN
    99   NaN
    Length: 100, dtype: float64
     

    1-2设置显示最大的行数

    In [4]:
    pd.set_option('display.max_rows',8)
    
    In [5]:
    pd.Series(index=range(0,100))#此集合只能显示8行
    
    Out[5]:
    0    NaN
    1    NaN
    2    NaN
    3    NaN
          ..
    96   NaN
    97   NaN
    98   NaN
    99   NaN
    Length: 100, dtype: float64
     

    2-1显示最大列数

    In [6]:
    pd.get_option('display.max_columns')
    
    Out[6]:
    20
    In [7]:
    pd.DataFrame(columns=range(0,30))#此集合只能显示20列
    
    Out[7]:
     
     0123456789...20212223242526272829

    0 rows × 30 columns

     

    2-2设置最大列数

    In [8]:
    pd.set_option('display.max_columns',30)
    pd.DataFrame(columns=range(0,30))#此集合只能显示30列
    
    Out[8]:
     
     01234567891011121314151617181920212223242526272829
     

    3-1字符串显示最大的宽度

    In [9]:
    pd.get_option('display.max_colwidth')#此字符串只能显示50宽度
    
    Out[9]:
    50
    In [10]:
    pd.Series(index=['a'],data=['t'*70])
    
    Out[10]:
    a    tttttttttttttttttttttttttttttttttttttttttttttt...
    dtype: object
     

    3-2设置字符串显示最大的宽度

    In [11]:
    pd.set_option('display.max_colwidth',10)#此字符串只能显示10宽度
    pd.Series(index=['a'],data=['t'*70])
    
    Out[11]:
    a    tttttt...
    dtype: object
     

    4-1数值的精度显示

    In [13]:
    pd.get_option('display.precision')#此字符串只能显示6宽度
    
    Out[13]:
    6
    In [14]:
    A=pd.Series(data=[1.22153415861441446])
    
     

    4-2设置数值的精度显示

    In [15]:
    pd.set_option('display.precision',5)
    A
    
    Out[15]:
    0    1.22153
    dtype: float64
  • 相关阅读:
    C# 还原SQL数据库(非存储过程方式)
    C# 无边框窗体移动代码
    SQL 2008 R2 数据库镜像操作
    序列号
    Oracle VM VirtualBox 随系统自动启动虚拟机的方法
    SQL每个用户最后的一条记录
    JS判断是否在微信浏览器打开
    使用device.js检测设备并实现不同设备展示不同网页
    check单选框多个全选与取消全选
    判断滚动是否到达底部
  • 原文地址:https://www.cnblogs.com/AI-robort/p/11636778.html
Copyright © 2011-2022 走看看