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
  • 相关阅读:
    JavaScript--函数、匿名函数和自执行函数详解
    HTML标签-----article、aside、figure、nav和section
    CSS文本(Text)属性-----letter-spacing和text-align
    CSS选择符-----伪类选择符
    JavaScript--元素对象方法setAttribute() 和appendChild()
    JavaScript--Document对象方法createElement()和createTextNode()
    Apache2.4使用require指令进行访问控制--允许或限制IP访问/通过User-Agent禁止不友好网络爬虫
    Null value was assigned to a property of primitive type setter of"原因及解决方法
    SQL SERVER中获取表间主外键关系
    解决Jboss中log4j在应用里面无法使用的问题
  • 原文地址:https://www.cnblogs.com/AI-robort/p/11636778.html
Copyright © 2011-2022 走看看