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

utils.write_json: Serialize Pandas Series #1213

Merged
merged 2 commits into from
Jun 14, 2023
Merged

Conversation

victorlin
Copy link
Member

@victorlin victorlin commented May 12, 2023

Description of proposed changes

There is a possibility that data to be written by this function contains a pandas Series which was un-serializable prior to this change.

Note: I did some digging to see what other possible data types could be in node_data and when they would be used, but didn't get too far. It has to do with modifications on the tree from TreeTime. This investigation should be continued to ensure all possible data types are serialized, so we can avoid similar bugs in the future.

Related issue(s)

Fixes #1209

Similar to #1119

Testing

  • Added a test
  • Checks pass

Checklist

  • Add a message in CHANGES.md summarizing the changes in this PR that are end user focused. Keep headers and formatting consistent with the rest of the file.

victorlin added 2 commits May 12, 2023 14:08
This isn't strictly used for numpy.
There is a possibility that data to be written by this function contains
a pandas Series which was un-serializable prior to this change.
@victorlin victorlin requested a review from a team May 12, 2023 22:35
@victorlin victorlin self-assigned this May 12, 2023
@codecov
Copy link

codecov bot commented May 12, 2023

Codecov Report

Patch coverage: 75.00% and no project coverage change.

Comparison is base (aade8fd) 68.81% compared to head (edb1e46) 68.82%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1213   +/-   ##
=======================================
  Coverage   68.81%   68.82%           
=======================================
  Files          64       64           
  Lines        6936     6938    +2     
  Branches     1692     1693    +1     
=======================================
+ Hits         4773     4775    +2     
  Misses       1856     1856           
  Partials      307      307           
Impacted Files Coverage Δ
augur/utils.py 72.24% <75.00%> (+0.22%) ⬆️

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

Copy link
Contributor

@huddlej huddlej left a comment

Choose a reason for hiding this comment

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

Thank you for figuring this out and fixing it, @victorlin! This looks like a useful enhancement and bug fix, even if we aren't sure whether the existence of pandas Series instances in TreeTime output is intended or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Augur refine produces a good tree file but a part built json file and throws error on finishing processes!
2 participants