Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Polars DataFrame be able to open on Variable Explorer. #20281

Open
10 tasks
arturdaraujo opened this issue Dec 30, 2022 · 8 comments
Open
10 tasks

Make Polars DataFrame be able to open on Variable Explorer. #20281

arturdaraujo opened this issue Dec 30, 2022 · 8 comments

Comments

@arturdaraujo
Copy link

Issue Report Checklist

  • Searched the issues page for similar reports
  • Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • Could not reproduce inside jupyter qtconsole (if console-related)
  • Tried basic troubleshooting (if a bug/error)
    • Restarted Spyder
    • Reset preferences with spyder --reset
    • Reinstalled the latest version of Anaconda
    • Tried the other applicable steps from the Troubleshooting Guide
  • Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

Make Polars dataframe variables able to open a window with the data like Pandas.
https://github.com/pola-rs/polars

What steps reproduce the problem?

When looking the in Variable Explorer, under the Type column the Polars object is a internals.dataframe.frame.DataFrame. The ideal it would be a DataFrame like Pandas.

What is the expected output? What do you see instead?

Paste Traceback/Error Below (if applicable)

PASTE TRACEBACK HERE

Versions

  • Spyder version:
  • Python version:
  • Qt version:
  • PyQt version:
  • Operating System name/version:

Dependencies

PASTE DEPENDENCIES HERE
@abudden
Copy link

abudden commented Jan 18, 2023

+1

Some screenshots to show the difference between polars and pandas:

image

Double clicking on the polars dataframe shows this, which isn't especially useful:

image

Similarly, using the example code from the getting started guide, the console printing seems a bit corrupted to me:

image

@arturdaraujo
Copy link
Author

arturdaraujo commented Jan 18, 2023

@abudden The dataframe format is now fixed in newer versions. The format is also more condensed. If you want it to use in this version you can set pl.Config.set_ascii_tables(True) or try pl.Config.set_tbl_formatting(“UTF8_FULL_CONDENSED”) which is the new default.

Take a look at:
https://pola-rs.github.io/polars/py-polars/html/reference/api/polars.Config.set_tbl_formatting.html#polars.Config.set_tbl_formatting

https://pola-rs.github.io/polars/py-polars/html/reference/config.html

@abudden
Copy link

abudden commented Jan 18, 2023

@arturdaraujo Great, thanks for letting me know - I'll upgrade.

@abudden
Copy link

abudden commented Jan 18, 2023

With 0.15.14, it looks better but still a little distorted; I guess this is something to do with my font (Envy Code R):

image

I'll probably just put up with it as the condensed formatting gets rid of most of the annoying intermediate lines so the small amount of distortion isn't a big deal. If it annoys me, I'll switch to ascii, which works fine.

Thanks again, and here's hoping for a variable explorer upgrade!

@arturdaraujo
Copy link
Author

You are probably using some different font like I do (Ubuntu). Some fonts need pl.Config.set_ascii_tables(True) for being completely fine and removing annoying defects. You can set condensed and and still call ascii True (which is my case). In spyder preferences you can write that to be called on startup, so you don't have to manually do that every time.

@ccordoba12
Copy link
Member

ccordoba12 commented Jan 18, 2023

Hey @arturdaraujo, thanks for reporting. This is an interesting idea but we're quite understaffed at the moment, so we won't be able to work on it, sorry.

@juliangilbey
Copy link
Contributor

A longer-term wishlist along these lines would be to bundle Polars with Spyder: it is quite likely that Polars will overtake Pandas in popularity in the coming few years.

@ccordoba12
Copy link
Member

That's a good idea but I think we should add it to our installers because it doesn't make much sense to have it as a direct dependency (Spyder can work perfectly fine without it).

@ccordoba12 ccordoba12 modified the milestones: wishlist, v6.1.0 Sep 18, 2024
@ccordoba12 ccordoba12 self-assigned this Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants