4

In PyCharm you have the ability to show a Pandas Dataframe with the SciView tool. Is this also possible with Polars or would I have to spam print statements?

(I also opened a PyCharm support ticket)

LazyOne
  • 158,824
  • 45
  • 388
  • 391
zacko
  • 179
  • 2
  • 9

2 Answers2

3

Polars DataFrames are not yet fully supported in PyCharm.

https://youtrack.jetbrains.com/issue/DS-2111 (was https://youtrack.jetbrains.com/issue/PY-50861 previously) -- watch this ticket (star/vote/comment) to get notified with any progress.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
0

I've updated the jetbrains issue above with a workaround

using polars api extensions. by adding and importing the class below you can access the pandas equiv view from variable explorer provided you have pyarrow installed to run df.to_pandas()

@pl.api.register_dataframe_namespace("pd") 
class PolarsPd:
    def __init__(self, df: DF):
        self.df = df.to_pandas()

if __name__ == '__main__':
    dfpl = pl.DataFrame({'a': [1, 2, 3]})

enter image description here

user1441053
  • 680
  • 1
  • 5
  • 10