2
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

pandasのprintで省略を防ぐ

Posted at

pandasのprintで省略されて嫌な時

rowをちゃんと見たい時

例えば、irisのデータは150rowsあるので、
そんな時は

pd.set_option('display.max_rows', 150)

を入れてあげる。

import pandas as pd
from sklearn import datasets

pd.set_option('display.max_rows', 150)
iris = datasets.load_iris()
df1 = pd.DataFrame(iris['data'])
print(df1)

columnをちゃんと見たい時

例えば、olivetti_facesのデータは4096columnsあるので、
そんな時は

pd.set_option('display.max_columns', 4096)

を入れてあげる。

import pandas as pd
from sklearn import datasets

pd.set_option('display.max_columns', 4096)
olivetti_faces = datasets.fetch_olivetti_faces()
df2 = pd.DataFrame(olivetti_faces['data']).head()

print(df2)
2
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?