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
  • 相关阅读:
    SQL Server XML数据解析
    c# XML和实体类之间相互转换(序列化和反序列化)
    C#解析XML详解(XPath以及带命名空间NameSpace)
    Jquery实现按钮点击遮罩加载,处理完后恢复
    jquery控制div随滚动条滚动效果
    asp.net中利用Jquery+Ajax+Json实现无刷新分页(二)
    easyUI tree点击文字展开节点
    201805牛客模拟考
    策略模式
    非线程安全演变成线程安全---原子性与加锁机制
  • 原文地址:https://www.cnblogs.com/AI-robort/p/11636778.html
Copyright © 2011-2022 走看看