/*******************************************************************************************************************
-- Title : [Py3.5] How to widen output display in Dataframe
-- Reference : http://stackoverflow.com/questions/11707586
-- Key word : pycharm dataframe output display 파이썬 파이참 데이터프레임 데이터 프레임 pandas width
                  display height max_rows max_columns width 디스플레이 set_option option 옵션
*******************************************************************************************************************/

-- PANDAS.Dataframe의 출력폭을 넓혀주는 것이지 Dataframe내 데이터 자체 출력 길이를 늘리는 것은 아닌 듯..
-- 찾았다!! 두번째 Script를 보시게들~!!

########################################
# -- Set Dataframe Option
########################################
pd.set_option('display.height', 1000)
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
pd.set_option('display.max_colwidth', -1)


# -*- coding: utf-8 -*-

import re
import pandas as pd
from pandas import Series, DataFrame

# -- Dictionary to Dataframe
dict_sample = \
{'sent': ['The quick brown fox jumps over the lazy dog',
'He loves his king and his queen.',
'This system is for DATA STORAGE UPON'],
'token_word' : [['The', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog'],
['He', 'loves', 'his', 'king', 'and', 'his', 'queen'],
['This', 'system', 'is', 'for', 'DATA', 'STORAGE', 'UPON']],
'filter_word': [['The', 'quick', 'brown', 'fox', 'jumps', 'lazy', 'dog'],
['He', 'loves', 'king', 'queen'],
['This', 'system', 'DATA', 'STORAGE', 'UPON']]}

# -- Print Dataframe with default option
df_word = DataFrame(dict_sample)
print(df_word)


# -- Print Dataframe with set_option
pd.set_option('display.height', 1000)
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)

print(df_word)


# -*- coding: utf-8 -*-

import pandas as pd


########################################
# -- Create Dataframe with Sample
########################################
dict_sample = \
{'aaa': [0, 1, 2, 3, 4, 5, 6, 7],
'bbb': ['Computer and computer system having the bond former function of power-off with the extension system.',
'Computer and computer system having the bond former function of power-off with the extension system.',
'Beautiful computer system having a function of auto power off before connecting with an expansion ' \
'system and having push button control thereof.',
'The car which is using a electric energy.',
'DRIVE WHEEL CONVERTING DEVICE OF A CAR.',
'ALL Computer having a function of auto power off before connecting with an expansion system.',
'This Computer having a function of auto power off before connecting with an expansion system.',
'Computer having a function of auto power off before connecting with an expansion system.']}

df_corpus = pd.DataFrame(dict_sample)
df_corpus.index.name = "id"

df_corpus["ccc"] = df_corpus["bbb"]
df_corpus["ddd"] = df_corpus["bbb"]
df_corpus["eee"] = df_corpus["bbb"]

print(df_corpus)
print("... no set_option", "." * 100, "\n")


########################################
# -- Set Dataframe Option
########################################

# -- 데이터프레임 출력 전체폭을 1000자로 확장
pd.set_option('display.width', 1000)

# -- 데이터프레임 출력 전체행을 1000개로 확장
pd.set_option('display.height', 1000)

# -- 데이터프레임 컬럼 길이 출력 제약을 제거
pd.set_option('display.max_colwidth', -1)


print(df_corpus)
print(";;; set_option('display.width', 1000)", ";" * 100, "\n")



+ Recent posts

티스토리 툴바