6

I can't visualize data frames with Styles in PyCharm. I'm using the following user guide: http://pandas-docs.github.io/pandas-docs-travis/user_guide/style.html

I only get a Pandas styler object (pandas.io.formats.style.Styler)

I'm using PyCharm 2018.3.7 and Pandas 0.25:

import pandas as pd
import numpy as np

np.random.seed(24)
df = pd.DataFrame({'A': np.linspace(1, 10, 10)})
df = pd.concat([df, pd.DataFrame(np.random.randn(10, 4), columns=list('BCDE'))],
               axis=1)
df.iloc[0, 2] = np.nan

df.style

I would like to generate some data frames with styles e.g. color-coded cells, conditional formatting...etc. Thank you for your help!

4
  • have you tried in jupyter Notebook ? that reference url used the jupyter not pycharm i don't think we can do styling in pycharm Commented Sep 27, 2019 at 13:25
  • 1
    Yes, I have, and it works perfectly there. I know I could switch IDEs, but if possible, I'd like to make it work in PyCharm. Thanks! Commented Sep 27, 2019 at 13:29
  • As jupyter notebook is using HTML, maybe by generating the html file through pycharm you can get it but it is probably gonna be quite fastidious Commented Sep 27, 2019 at 13:41
  • Thank you for the inputs so far! I'm not an engineer, actually I'm a data scientist, so I probably miss a lot of details. Could you explain why PyCharm can't do this? Thanks! Commented Sep 27, 2019 at 14:01

1 Answer 1

3

Pandas styler generates HTML as string when you execute df.style.render().

A web browser interprets HTML and displays it in the browser.

Pycharm is not a webbrowser - it does not parse and display HTML.

Jupyter Notebook is an application written in python that uses a web browser. It provides a bridge between python and the web browser which is why you can create a pandas styler object and then see the results as rendered HTML because it has both functionalities.

You cant do this in Pycharm.

Sign up to request clarification or add additional context in comments.

2 Comments

VSCode+Jupyter can render Pandas tables with styles, so why not PyCharm?
The answer to your comment is stated, clearly in the third paragraph of this answer. If Jetbrains, as a private company, have not developed that feature for their software by 2024, go and post a feature request on their forums.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.