GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(v2): add from and to pandas df for documentarray by anna-charlotte · Pull Request #1161 · docarray/docarray

This repository was archived by the owner on Sep 9, 2026. It is now read-only.

Conversation

@anna-charlotte

@anna-charlotte anna-charlotte commented Feb 22, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Add from and to pandas to DocumentArray IOMixin

  • add DocumentArray[Doc].from_pandas(df)
  • add da.to_pandas()
  • check and update documentation, if required. See guide

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
anna-charlotte and others added 21 commits February 20, 2023 15:06
anna-charlotte
feat: load from and to csv
dce8c6b
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: from to csv
37892a9
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
feat: add access path to dict
e1e90cf
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: from to csv
7bd7f1f
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: clean up
05e19ba
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
docs: add docstring and update tmpdir in test
5b0c760
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: merge nested dicts
5babdae
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: clean up
d6b29c5
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: clean up
9149e57
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
test: update test
3d980b7
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: apply samis suggestion from code review
516ffbb
Signed-off-by: anna-charlotte <[email protected]>
Charlotte Gerhaher
Merge branch 'feat-rewrite-v2' into feat-from-to-csv
5fac964
anna-charlotte
fix: apply suggestions from code review wrt access paths
a0d9711
Signed-off-by: anna-charlotte <[email protected]>
Charlotte Gerhaher @JohannesMessner
fix: apply johannes suggestion
c9005b1
Co-authored-by: Johannes Messner <[email protected]>
Signed-off-by: Charlotte Gerhaher <[email protected]>
Charlotte Gerhaher @JohannesMessner
fix: apply johannes suggestion
9fe58f5
Co-authored-by: Johannes Messner <[email protected]>
Signed-off-by: Charlotte Gerhaher <[email protected]>
anna-charlotte
fix: apply suggestions from code review
90867bb
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: apply suggestions from code review
1a395da
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: typos
00a9ea7
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
refactor: move helper functions to helper file
e06e533
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
test: fix fixture
c8e4cf8
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
feat: add to and from pandas df for documentarray
6e3a624
Signed-off-by: anna-charlotte <[email protected]>
@github-actions github-actions Bot added size/l area/core area/testing component/array labels Feb 22, 2023
anna-charlotte
chore: add pandas to pyproject.toml
12df134
Signed-off-by: anna-charlotte <[email protected]>
@github-actions github-actions Bot added the area/setup label Feb 22, 2023
anna-charlotte added 3 commits February 22, 2023 11:50
anna-charlotte
docs: update docstring
504c13c
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: mypy
4bf8976
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: clean up
ca2bf4f
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
Merge remote-tracking branch 'origin/feat-rewrite-v2' into feat-from-…
81ea38d
…to-pandas

Signed-off-by: anna-charlotte <[email protected]>
@github-actions github-actions Bot added size/m and removed size/l labels Feb 22, 2023
@anna-charlotte
anna-charlotte requested review from JohannesMessner and samsja February 22, 2023 13:38
@anna-charlotte
anna-charlotte marked this pull request as ready for review February 22, 2023 13:38
@anna-charlotte anna-charlotte mentioned this pull request Feb 23, 2023
Meta: DocArray v2 Roadmap #780
Closed
42 of 47 tasks
samsja
samsja reviewed Feb 23, 2023
View reviewed changes
Comment thread docarray/array/array/io.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

samsja
samsja reviewed Feb 23, 2023
View reviewed changes
Comment thread pyproject.toml Outdated
rich = ">=13.1.0"
lz4 = {version= ">=1.0.0", optional = true}
pydub = {version = "^0.25.1", optional = true }
pandas = ">=1.1.0"

@samsja samsja Feb 23, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

it should be an optional dependecy

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@anna-charlotte anna-charlotte Feb 23, 2023

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

add it to common or a as a separate extra pandas ?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@samsja samsja Feb 23, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

separate. we will reorginaze at some point anyway

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

anna-charlotte reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
samsja
samsja reviewed Feb 23, 2023
View reviewed changes

@samsja samsja left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

look goods, I added some comments

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

anna-charlotte reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
JohannesMessner
JohannesMessner suggested changes Feb 23, 2023
View reviewed changes
Comment thread docarray/array/array/io.py Outdated
)

@staticmethod
def access_path_dict_to_nested_dict(

@JohannesMessner JohannesMessner Feb 23, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

didn't you already implement something like this in your previous PR? or am i mixing things up?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@anna-charlotte anna-charlotte Feb 23, 2023

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

yes, the function _access_path_to_dict that is used within _access_path_dict_to_nested_dict that I implemented in the last PR.

  • _access_path_to_dict: transforms one access path to nested dict
  • _ access_path_dict_to_nested_dict: transforms dict with (multiple) access path keys to a joint nested dict by calling the former func

I will move the latter to that other helper file, to keep those functions together yes?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@JohannesMessner JohannesMessner Feb 23, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

ok sounds good, yes keeping them in the same helper file would be ideal

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread docarray/array/array/io.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docarray/array/array/io.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docarray/array/array/io.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docarray/array/array/io.py Outdated
return json.dumps([doc.json() for doc in self])

@classmethod
def _check_for_valid_document_type(cls) -> None:

@JohannesMessner JohannesMessner Feb 23, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I would prefer returning a bool and rasing at the call site. That way it is clearer where the error actually occurs, and this method can be re-used in contexts where only the information is needed, without wanting to raise an exception

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

samsja reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread docarray/array/array/io.py Outdated
)

@classmethod
def _check_for_valid_access_paths(cls, field_names: Optional[List[str]]) -> None:

@JohannesMessner JohannesMessner Feb 23, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

same here

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread docarray/array/array/io.py Outdated

@classmethod
def _check_for_valid_document_type(cls) -> None:
if cls.document_type == AnyDocument:

@JohannesMessner JohannesMessner Feb 23, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

is there are plan to make this check more sophisticated as part of this PR? otherwise this doesn't need to be a method imo

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@anna-charlotte anna-charlotte Feb 23, 2023

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

No, just tried to extract all the duplicate code but maybe I went a bit overboard hehe, moved it back to from_csv and from_pandas again

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

JohannesMessner reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
This was linked to issues Feb 23, 2023
v2: handle load from external data sources #971
Closed
Implement from_to/csv,pandas #1126
Closed
anna-charlotte and others added 6 commits February 23, 2023 11:39
anna-charlotte
fix: apply suggestions from code review
5d02b35
Signed-off-by: anna-charlotte <[email protected]>
Charlotte Gerhaher @JohannesMessner
fix: apply suggestion from johannes
687d98a
Co-authored-by: Johannes Messner <[email protected]>
Signed-off-by: Charlotte Gerhaher <[email protected]>
Charlotte Gerhaher @JohannesMessner
fix: apply suggestion from johannes
2c02bf4
Co-authored-by: Johannes Messner <[email protected]>
Signed-off-by: Charlotte Gerhaher <[email protected]>
anna-charlotte
fix: apply suggestions from code review
006a186
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: apply suggestion
c68a48c
Signed-off-by: anna-charlotte <[email protected]>
Charlotte Gerhaher
Merge branch 'feat-rewrite-v2' into feat-from-to-pandas
fb74c4f
samsja
samsja reviewed Feb 23, 2023
View reviewed changes
Comment thread docarray/array/array/io.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

samsja
samsja reviewed Feb 23, 2023
View reviewed changes
Comment thread docarray/array/array/io.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

samsja
samsja suggested changes Feb 23, 2023
View reviewed changes

@samsja samsja left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

we should make pandas install optional. Otherwise looks good

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
anna-charlotte
fix: apply suggestions
9d90053
Signed-off-by: anna-charlotte <[email protected]>
samsja
samsja approved these changes Feb 23, 2023
View reviewed changes
@github-actions

github-actions Bot commented Feb 23, 2023

Copy link
Copy Markdown

📝 Docs are deployed on https://ft-feat-from-to-pandas--jina-docs.netlify.app 🎉

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

JohannesMessner
JohannesMessner approved these changes Feb 23, 2023
View reviewed changes
@anna-charlotte
anna-charlotte merged commit 4de28ea into feat-rewrite-v2 Feb 23, 2023
@anna-charlotte
anna-charlotte deleted the feat-from-to-pandas branch February 23, 2023 12:48
AsRaNi1 pushed a commit to AsRaNi1/docarray that referenced this pull request Feb 28, 2023
Charlotte Gerhaher @JohannesMessner @AsRaNi1
feat(v2): add from and to pandas df for documentarray (docarray#1161)
025fb66
* feat: load from and to csv

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

* fix: from to csv

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

* feat: add access path to dict

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

* fix: from to csv

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

* fix: clean up

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

* docs: add docstring and update tmpdir in test

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

* fix: merge nested dicts

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

* fix: clean up

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

* fix: clean up

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

* test: update test

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

* fix: apply samis suggestion from code review

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

* fix: apply suggestions from code review wrt access paths

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

* fix: apply johannes suggestion

Co-authored-by: Johannes Messner <[email protected]>
Signed-off-by: Charlotte Gerhaher <[email protected]>

* fix: apply johannes suggestion

Co-authored-by: Johannes Messner <[email protected]>
Signed-off-by: Charlotte Gerhaher <[email protected]>

* fix: apply suggestions from code review

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

* fix: apply suggestions from code review

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

* fix: typos

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

* refactor: move helper functions to helper file

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

* test: fix fixture

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

* feat: add to and from pandas df for documentarray

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

* chore: add pandas to pyproject.toml

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

* docs: update docstring

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

* fix: mypy

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

* fix: clean up

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

* fix: apply suggestions from code review

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

* fix: apply suggestion from johannes

Co-authored-by: Johannes Messner <[email protected]>
Signed-off-by: Charlotte Gerhaher <[email protected]>

* fix: apply suggestion from johannes

Co-authored-by: Johannes Messner <[email protected]>
Signed-off-by: Charlotte Gerhaher <[email protected]>

* fix: apply suggestions from code review

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

* fix: apply suggestion

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

* fix: apply suggestions

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

---------

Signed-off-by: anna-charlotte <[email protected]>
Signed-off-by: Charlotte Gerhaher <[email protected]>
Co-authored-by: Johannes Messner <[email protected]>
Signed-off-by: Arnav Zutshi <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@JohannesMessner JohannesMessner JohannesMessner approved these changes
@samsja samsja samsja approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

area/core area/setup area/testing component/array size/m

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Implement from_to/csv,pandas v2: handle load from external data sources

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@anna-charlotte @JohannesMessner @samsja
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.