Skip to content

fix: replace newline with whitespace to fix display in plot embeddings#963

Merged
samsja merged 2 commits intomainfrom
fix-display-plot-embeddings
Jan 3, 2023
Merged

fix: replace newline with whitespace to fix display in plot embeddings#963
samsja merged 2 commits intomainfrom
fix-display-plot-embeddings

Conversation

@anna-charlotte
Copy link
Copy Markdown
Contributor

@anna-charlotte anna-charlotte commented Jan 2, 2023

Signed-off-by: anna-charlotte [email protected]

If a Documents fields contain '\n' this messes up the display in .plot_embeddings().
Therefore we want to replace all '\n' with whitespaces for display.

E.g. for the following Document:

image

The information of that Document looks like this:
Screenshot 2023-01-02 at 09 27 03

But should look like this:
Screenshot 2023-01-02 at 09 06 41

  • replace all '\n' with whitespaces in .plot_embeddings()
  • check and update documentation, if required. See guide

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 2, 2023

Codecov Report

Base: 85.20% // Head: 85.20% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (01a6678) compared to base (b18f5da).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #963   +/-   ##
=======================================
  Coverage   85.20%   85.20%           
=======================================
  Files         155      155           
  Lines        8050     8051    +1     
=======================================
+ Hits         6859     6860    +1     
  Misses       1191     1191           
Flag Coverage Δ
docarray 85.20% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
docarray/array/mixins/io/csv.py 89.74% <100.00%> (+0.26%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Copy Markdown
Member

@JohannesMessner JohannesMessner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, love to see PR descriptions like this one! 👍

t = pd.pop('tags')
pd.update({f'tag__{k}': v for k, v in t.items()})

pd = {k: str(v).replace('\n', ' ') for k, v in pd.items()}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets rename this to something else than pd since this is usually use for pandas

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I don't understand is why the parser don't just do a return to the line by itself ? Is it because it does not handle it ?

@JoanFM
Copy link
Copy Markdown
Member

JoanFM commented Jan 2, 2023

have we checked if this is a documented feature/behavior of the dependency we use to plot embeddings? if not, we could in parallel open an issue to them to see if we can remove the hack in the future

@anna-charlotte
Copy link
Copy Markdown
Contributor Author

we could in parallel open an issue to them

Ok, I will check

Signed-off-by: anna-charlotte <[email protected]>
@samsja samsja enabled auto-merge (squash) January 3, 2023 12:42
@samsja samsja disabled auto-merge January 3, 2023 12:42
@samsja samsja merged commit a1f4a43 into main Jan 3, 2023
@samsja samsja deleted the fix-display-plot-embeddings branch January 3, 2023 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants