Skip to content

fix: use pd.concat() instead df.append() in to_dataframe() to avoid warning#1478

Merged
JoanFM merged 2 commits intomainfrom
fix-warning-in-to-dataframe
Apr 28, 2023
Merged

fix: use pd.concat() instead df.append() in to_dataframe() to avoid warning#1478
JoanFM merged 2 commits intomainfrom
fix-warning-in-to-dataframe

Conversation

@anna-charlotte
Copy link
Copy Markdown
Contributor

To avoid this warning, use pd.concat():
image

@JoanFM JoanFM marked this pull request as ready for review April 28, 2023 08:50
Signed-off-by: anna-charlotte <[email protected]>
df_doc = pd.DataFrame(_dict_to_access_paths(doc.dict()))
df = pd.concat([df, df_doc], ignore_index=True)
doc_dict = _dict_to_access_paths(doc.dict())
doc_dict = {k: [v] for k, v in doc_dict.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.

why do u need to convert them to list?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

pd.DataFrame.from_dict() expects a dict with the column names as keys, and the values have to be a list, therefore I wrap the value with a list

Copy link
Copy Markdown
Contributor Author

@anna-charlotte anna-charlotte Apr 28, 2023

Choose a reason for hiding this comment

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

like this v[0] would correspond to the first row, v[1] to the second row and so on. In our case we only have v[0] since len(v) = 1

@github-actions
Copy link
Copy Markdown

📝 Docs are deployed on https://ft-fix-warning-in-to-dataframe--jina-docs.netlify.app 🎉

@JoanFM JoanFM merged commit baaf5cb into main Apr 28, 2023
@JoanFM JoanFM deleted the fix-warning-in-to-dataframe branch April 28, 2023 09:40
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.

2 participants