パンダは、彼らの行動は、多くの場合、表示するために使用される定義特定の側面からのAPIを提供しています。
APIは、5つの機能関連のコンポーネントで構成されています。彼らは以下のとおりです。
- get_option()
- SET_OPTION()
- reset_option()
- describe_option()
- option_context()
一般的なパラメータは、次の表を参照してください。
番号 | パラメータ | 説明 |
---|---|---|
1 | display.max_rows |
ディスプレイへの行の最大数 |
2 | display.max_columns |
列の最大数を表示します |
3 | display.expand_frame_repr |
ページに表示データのフレームを伸ばします |
4 | display.max_colwidth |
最大列幅を表示します |
5 | display.precision |
表示精度の小数 |
get_option(パラメータ)
get_option(param)
これは、パラメータを必要とし、与えられた値を返します。
- display.max_rowsは、デフォルト値を示します。この値は、この値が上限線として表示されるインタプリタ及びディスプレイによって読み取られます。
- display.max_columnsは、この値は、この値が上限線として表示されるインタプリタ及びディスプレイによって読み取られ、デフォルト値を表示します。
インポートのPdとしてパンダ プリント(" display.max_rows = "、pd.get_option(" display.max_rows " )) プリント(" display.max_columns = "、pd.get_option(" display.max_columns "))
出力 -
display.max_rows = 60
display.max_columns = 20
ここでは、60
および20
デフォルトの設定パラメータの値です。
SET_OPTION(パラメータ値)
set_option
これは、2つのパラメータ、及び指定された値にパラメータ値を必要とします。
インポートのPdとしてパンダ プリント(" セットdisplay.max_rows前= "、pd.get_option(" display.max_rows " )) プリント(" セットdisplay.max_columns前= "、pd.get_option(" display.max_columns " )) PD。 SET_OPTION(" display.max_rows "、80 ) pd.set_option(" display.max_columns "、42 ) プリント(" セットdisplay.max_rows後= "、PD。get_option( "display.max_rows " )) プリント(" セットdisplay.max_columns後= "pd.get_option( " display.max_columns "))
セットdisplay.max_rows前= 60
セットdisplay.max_columns前= 20
セットdisplay.max_rows後= 80
セットdisplay.max_columns後= 42
reset_option(パラメータ)
reset_option
これは、パラメータを受け取り、値がデフォルト値に設定されています。
インポートのPdとしてパンダ PD。SET_OPTION(" display.max_rows "、32 ) プリント(" セットdisplay.max_rows後= "、pd.get_option(" display.max_rows " )) PD。reset_option(" display.max_rows " ) プリント(" display.max_rowsリセット= "、pd.get_option(" display.max_rows "))
出力:
after set display.max_rows = 32
reset display.max_rows = 60
describe_option(パラメータ)
describe_option
パラメータの印刷について。
インポートのPdとしてパンダ pd.describe_option(" display.max_rows ")
出力:
display.max_rows : int
If max_rows is exceeded, switch to truncate view. Depending on
`large_repr`, objects are either centrally truncated or printed as
a summary view. 'None' value means unlimited.
In case python/IPython is running in a terminal and `large_repr`
equals 'truncate' this can be set to 0 and pandas will auto-detect
the height of the terminal and print a truncated object which fits
the screen height. The IPython notebook, IPython qtconsole, or
IDLE do not run in a terminal and hence it is not possible to do
correct auto-detection.
[default: 60] [currently: 60]
option_context()
option_context
一時的な設定ステートメント・オプションのコンテキストマネージャ。あなたが使用してブロックを終了すると、オプションの値が自動的に復元されます。
インポートPd等パンダ pd.option_context有する(" display.max_rows "、10 ): プリント(pd.get_option(" display.max_rows " )) プリント(pd.get_option(" display.max_rows "))
出力:
10
60
最初の文はで印刷されoption_context()
、この文脈では一時的な値である値、。コンテキストを使用した後、第二の印刷文は、値を印刷するように構成します。