polars icon indicating copy to clipboard operation
polars copied to clipboard

fix(python): Include pl. qualifier for inner dtypes in to_init_repr()

Open datenzauberai opened this issue 1 year ago • 4 comments

Closes #15802

This is a minimal fix for https://github.com/pola-rs/polars/issues/15802 by adding a method that prefixes representations, which will be called "recursively" for nested types.

datenzauberai avatar May 15 '24 09:05 datenzauberai

I somehow managed to close the preceding PR https://github.com/pola-rs/polars/pull/16223 where @stinodego suggested to create a utility function instead of putting this into the DataType classes.

datenzauberai avatar May 15 '24 09:05 datenzauberai

It would be an option to include an optional prefix parameter for DataFrame.to_init_repr and Series.to_init_repr, but I don't think this flexibility is really needed.

datenzauberai avatar May 15 '24 09:05 datenzauberai

Codecov Report

Attention: Patch coverage is 87.50000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 80.80%. Comparing base (a7f9c8d) to head (266ef82). Report is 1 commits behind head on main.

:exclamation: Current head 266ef82 differs from pull request most recent head 316f772

Please upload reports for the commit 316f772 to get more accurate results.

Files Patch % Lines
py-polars/polars/datatypes/_utils.py 87.09% 2 Missing and 2 partials :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16235      +/-   ##
==========================================
- Coverage   81.32%   80.80%   -0.52%     
==========================================
  Files        1423     1394      -29     
  Lines      187177   179407    -7770     
  Branches     2721     2927     +206     
==========================================
- Hits       152214   144975    -7239     
+ Misses      34468    33927     -541     
- Partials      495      505      +10     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 15 '24 09:05 codecov[bot]

Noted one extra thing: Is it really possible with the current version to have a pl.List/pl.Array without a properly defined inner dtype (I think that was possible in the past)? In the constructor both call py_type_to_dtype which would raise an Exception. Would simplify things a little bit...

datenzauberai avatar May 16 '24 08:05 datenzauberai

Any news on this one @stinodego

ritchie46 avatar May 22 '24 13:05 ritchie46

Just a friendly ping regarding the open pull request @stinodego

datenzauberai avatar Jun 06 '24 08:06 datenzauberai

It looks good, but the Array repr has been updated. I'll send an update and this can be merged.

stinodego avatar Jun 06 '24 08:06 stinodego