user7340
user7340

Reputation: 274

Pycharm not displaying wide Dataframe in Jupyter Notebook

In Pycharm, I'm using a Jupyter notebook, but when the pandas dataframe I'm working with gets wider than the width of the cell it doesn't display the dataframe anymore. Instead there's just a horizontal line across the output cell. I've tried setting the max columns, width, and every other pandas display option and it's still happening. The dataframe displays fine if I widen the Pycharm window, but for dataframes wider than my screen that's not possible.

Here's a screengrab of what it looks like

import pandas as pd
import numpy as np

display(HTML("<style>.container { width:95% !important; }</style>"))
pd.options.display.max_rows = 50
pd.options.display.max_columns = 200
desired_width = 320    
pd.set_option('display.width', desired_width)
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.expand_frame_repr', False)
pd.set_option('display.max_columns', None)


dates = pd.date_range('20130101',periods=6)
dates
df = pd.DataFrame(np.random.randn(6,19),index=dates,columns=list('ABCDEFGHIJKLMNOPQRS'))
#df
df = pd.DataFrame(np.random.randn(6,11),index=dates,columns=list('ABCDEFGHIJK'))
df
#df = pd.DataFrame(np.random.randn(6,8),index=dates,columns=list('ABCDEFGH'))

Upvotes: 8

Views: 2233

Answers (1)

Furkan Tektas
Furkan Tektas

Reputation: 364

This is a PyCharm bug and it still has not been resolved in the latest (2017.3) version.

Only 1D dataframes are shown as expected, multidimensional dataframes are shown as a horizontal line.

You can vote this issue in IntelliJ's issue tracker: https://youtrack.jetbrains.com/issue/PY-25931

Upvotes: 1

Related Questions